<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="fr">
	<id>http://www.yakakliker.org/index.php?action=history&amp;feed=atom&amp;title=Python_%3A_Pythondialog</id>
	<title>Python : Pythondialog - Historique des versions</title>
	<link rel="self" type="application/atom+xml" href="http://www.yakakliker.org/index.php?action=history&amp;feed=atom&amp;title=Python_%3A_Pythondialog"/>
	<link rel="alternate" type="text/html" href="http://www.yakakliker.org/index.php?title=Python_:_Pythondialog&amp;action=history"/>
	<updated>2026-05-02T04:48:26Z</updated>
	<subtitle>Historique des versions pour cette page sur le wiki</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>http://www.yakakliker.org/index.php?title=Python_:_Pythondialog&amp;diff=1915&amp;oldid=prev</id>
		<title>Administrateur le 22 janvier 2026 à 13:22</title>
		<link rel="alternate" type="text/html" href="http://www.yakakliker.org/index.php?title=Python_:_Pythondialog&amp;diff=1915&amp;oldid=prev"/>
		<updated>2026-01-22T13:22:16Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;fr&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Version précédente&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Version du 22 janvier 2026 à 15:22&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l83&quot;&gt;Ligne 83 :&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Ligne 83 :&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* &amp;#039;&amp;#039;&amp;#039;Navigation&amp;#039;&amp;#039;&amp;#039; : Vous utilisez les flèches pour le menu, et la touche &amp;#039;&amp;#039;&amp;#039;Tabulation&amp;#039;&amp;#039;&amp;#039; pour passer du menu aux boutons &amp;quot;OK/Annuler&amp;quot;.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* &amp;#039;&amp;#039;&amp;#039;Navigation&amp;#039;&amp;#039;&amp;#039; : Vous utilisez les flèches pour le menu, et la touche &amp;#039;&amp;#039;&amp;#039;Tabulation&amp;#039;&amp;#039;&amp;#039; pour passer du menu aux boutons &amp;quot;OK/Annuler&amp;quot;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;=== Pour créer un binaire / exécutable ===&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;syntaxhighlight lang=&quot;bash&quot;&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;pyinstaller --noconsole --onefile main.py&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Catégorie:Python]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Catégorie:Python]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Catégorie:Scripts]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Catégorie:Scripts]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key mediawikidb:diff:1.41:old-1914:rev-1915:php=table --&gt;
&lt;/table&gt;</summary>
		<author><name>Administrateur</name></author>
	</entry>
	<entry>
		<id>http://www.yakakliker.org/index.php?title=Python_:_Pythondialog&amp;diff=1914&amp;oldid=prev</id>
		<title>Administrateur : Page créée avec « === Installation === &lt;syntaxhighlight lang=&quot;bash&quot;&gt; sudo apt install dialog pip install pythondialog &lt;/syntaxhighlight&gt;  === Exemple === &lt;syntaxhighlight lang=&quot;python3&quot;&gt; import json from dialog import Dialog  # Initialisation de l&#039;objet Dialog # autowidgetsize=True permet d&#039;ajuster la taille selon le contenu d = Dialog(dialog=&quot;dialog&quot;, autowidgetsize=True) FICHIER = &quot;mes_invites.json&quot;  def charger_donnees():     try:         with open(FICHIER, &quot;r&quot;, encoding=&quot;utf-8... »</title>
		<link rel="alternate" type="text/html" href="http://www.yakakliker.org/index.php?title=Python_:_Pythondialog&amp;diff=1914&amp;oldid=prev"/>
		<updated>2026-01-22T13:19:32Z</updated>

		<summary type="html">&lt;p&gt;Page créée avec « === Installation === &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt; sudo apt install dialog pip install pythondialog &amp;lt;/syntaxhighlight&amp;gt;  === Exemple === &amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt; import json from dialog import Dialog  # Initialisation de l&amp;#039;objet Dialog # autowidgetsize=True permet d&amp;#039;ajuster la taille selon le contenu d = Dialog(dialog=&amp;quot;dialog&amp;quot;, autowidgetsize=True) FICHIER = &amp;quot;mes_invites.json&amp;quot;  def charger_donnees():     try:         with open(FICHIER, &amp;quot;r&amp;quot;, encoding=&amp;quot;utf-8... »&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Nouvelle page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;=== Installation ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
sudo apt install dialog&lt;br /&gt;
pip install pythondialog&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Exemple ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python3&amp;quot;&amp;gt;&lt;br /&gt;
import json&lt;br /&gt;
from dialog import Dialog&lt;br /&gt;
&lt;br /&gt;
# Initialisation de l&amp;#039;objet Dialog&lt;br /&gt;
# autowidgetsize=True permet d&amp;#039;ajuster la taille selon le contenu&lt;br /&gt;
d = Dialog(dialog=&amp;quot;dialog&amp;quot;, autowidgetsize=True)&lt;br /&gt;
FICHIER = &amp;quot;mes_invites.json&amp;quot;&lt;br /&gt;
&lt;br /&gt;
def charger_donnees():&lt;br /&gt;
    try:&lt;br /&gt;
        with open(FICHIER, &amp;quot;r&amp;quot;, encoding=&amp;quot;utf-8&amp;quot;) as f:&lt;br /&gt;
            return json.load(f)&lt;br /&gt;
    except FileNotFoundError:&lt;br /&gt;
        return []&lt;br /&gt;
&lt;br /&gt;
def sauvegarder_donnees(liste):&lt;br /&gt;
    with open(FICHIER, &amp;quot;w&amp;quot;, encoding=&amp;quot;utf-8&amp;quot;) as f:&lt;br /&gt;
        json.dump(liste, f, indent=4, ensure_ascii=False)&lt;br /&gt;
&lt;br /&gt;
def main():&lt;br /&gt;
    invites = charger_donnees()&lt;br /&gt;
&lt;br /&gt;
    while True:&lt;br /&gt;
        # Affichage du menu principal&lt;br /&gt;
        # Format : (Code_Retour, Tag_Selectionné)&lt;br /&gt;
        code, tag = d.menu(&amp;quot;Gestionnaire d&amp;#039;Invités&amp;quot;,&lt;br /&gt;
                           choices=[(&amp;quot;1&amp;quot;, &amp;quot;Voir les invités&amp;quot;),&lt;br /&gt;
                                    (&amp;quot;2&amp;quot;, &amp;quot;Ajouter un invité&amp;quot;),&lt;br /&gt;
                                    (&amp;quot;3&amp;quot;, &amp;quot;Supprimer un invité&amp;quot;),&lt;br /&gt;
                                    (&amp;quot;4&amp;quot;, &amp;quot;Quitter&amp;quot;)])&lt;br /&gt;
&lt;br /&gt;
        if code == d.CANCEL or tag == &amp;quot;4&amp;quot;:&lt;br /&gt;
            break&lt;br /&gt;
&lt;br /&gt;
        if tag == &amp;quot;1&amp;quot;:&lt;br /&gt;
            # Construction de la chaîne de caractères pour l&amp;#039;affichage&lt;br /&gt;
            texte = &amp;quot;\n&amp;quot;.join([f&amp;quot;• {i[&amp;#039;nom&amp;#039;]} ({i[&amp;#039;age&amp;#039;]} ans)&amp;quot; for i in invites])&lt;br /&gt;
            d.msgbox(texte if texte else &amp;quot;La liste est vide.&amp;quot;, title=&amp;quot;Liste des invités&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
        elif tag == &amp;quot;2&amp;quot;:&lt;br /&gt;
            # Saisie du nom&lt;br /&gt;
            code_nom, nom = d.inputbox(&amp;quot;Entrez le nom de l&amp;#039;invité :&amp;quot;)&lt;br /&gt;
            if code_nom == d.OK and nom:&lt;br /&gt;
                # Saisie de l&amp;#039;âge&lt;br /&gt;
                code_age, age = d.inputbox(f&amp;quot;Âge de {nom} :&amp;quot;)&lt;br /&gt;
                if code_age == d.OK and age.isdigit():&lt;br /&gt;
                    invites.append({&amp;quot;nom&amp;quot;: nom, &amp;quot;age&amp;quot;: int(age)})&lt;br /&gt;
                    sauvegarder_donnees(invites)&lt;br /&gt;
                    d.msgbox(&amp;quot;Invité ajouté !&amp;quot;, title=&amp;quot;Succès&amp;quot;)&lt;br /&gt;
                else:&lt;br /&gt;
                    d.msgbox(&amp;quot;Erreur : Âge invalide.&amp;quot;, title=&amp;quot;Erreur&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
        elif tag == &amp;quot;3&amp;quot;:&lt;br /&gt;
            # Création d&amp;#039;une liste de choix pour la suppression&lt;br /&gt;
            choix_suppr = [(str(i), f&amp;quot;{inv[&amp;#039;nom&amp;#039;]} ({inv[&amp;#039;age&amp;#039;]} ans)&amp;quot;) &lt;br /&gt;
                           for i, inv in enumerate(invites)]&lt;br /&gt;
            if choix_suppr:&lt;br /&gt;
                code_s, tag_s = d.menu(&amp;quot;Choisissez l&amp;#039;invité à supprimer :&amp;quot;, choices=choix_suppr)&lt;br /&gt;
                if code_s == d.OK:&lt;br /&gt;
                    index = int(tag_s)&lt;br /&gt;
                    invites.pop(index)&lt;br /&gt;
                    sauvegarder_donnees(invites)&lt;br /&gt;
            else:&lt;br /&gt;
                d.msgbox(&amp;quot;Personne à supprimer.&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
if __name__ == &amp;quot;__main__&amp;quot;:&lt;br /&gt;
    main()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Analyse ====&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;&amp;lt;code&amp;gt;d.menu()&amp;lt;/code&amp;gt;&amp;#039;&amp;#039;&amp;#039; : Affiche une liste de choix. Vous devez fournir une liste de tuples &amp;lt;code&amp;gt;(Tag, Description)&amp;lt;/code&amp;gt;. C&amp;#039;est le &amp;quot;Tag&amp;quot; qui est renvoyé par la fonction.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;&amp;lt;code&amp;gt;d.msgbox()&amp;lt;/code&amp;gt;&amp;#039;&amp;#039;&amp;#039; : Une simple boîte d&amp;#039;information avec un bouton &amp;quot;OK&amp;quot;.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;&amp;lt;code&amp;gt;d.inputbox()&amp;lt;/code&amp;gt;&amp;#039;&amp;#039;&amp;#039; : Une zone de saisie. Elle renvoie un code (OK/CANCEL) et la chaîne de caractères tapée.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Navigation&amp;#039;&amp;#039;&amp;#039; : Vous utilisez les flèches pour le menu, et la touche &amp;#039;&amp;#039;&amp;#039;Tabulation&amp;#039;&amp;#039;&amp;#039; pour passer du menu aux boutons &amp;quot;OK/Annuler&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Catégorie:Python]]&lt;br /&gt;
[[Catégorie:Scripts]]&lt;/div&gt;</summary>
		<author><name>Administrateur</name></author>
	</entry>
</feed>