def buildUI(self, topframe, callbackDict): import tkinter.ttk as ttk import tkinter as tk ret = {} frame = ttk.Frame(topframe) typeEtatLbl = ttk.Label(frame, text="Type d'état:") typeEtatLbl.pack(side="left") self.typeEtatCombobox = ttk.Combobox(frame, values=sorted(Etat.getListEtat()), state="readonly") self.typeEtatCombobox.set(self.etat.__class__.__name__) self.typeEtatCombobox.pack(side="left") self.typeEtatCombobox.bind('<<ComboboxSelected>>', self.etatTypeModified) self.etatCaracsFrame = ttk.LabelFrame( frame, text="Caractéristiques de l'état") self.etatCaracsFrame.pack(side="top") self.etatTypeModified() etatOptionFrame = ttk.Frame(frame) cumulMaxLbl = ttk.Label(etatOptionFrame, text="Cumul max:") cumulMaxLbl.grid(row=0, column=0, sticky="e") cumulMaxSpinbox = tk.Spinbox(etatOptionFrame, from_=-1, to=99, width=3) cumulMaxSpinbox.delete(0, 'end') cumulMaxSpinbox.insert(0, int(self.kwargs.get("cumulMax", -1))) cumulMaxSpinbox.grid(row=0, column=1, sticky="w") ret["kwargs:cumulMax"] = cumulMaxSpinbox ret["etat"] = self.etatWidgets etatOptionFrame.pack(side="bottom") frame.pack() return ret
def buildUI(self, topframe, callbackDict): import tkinter.ttk as ttk import tkinter as tk ret = {} frame = ttk.Frame(topframe) typeEtatLbl = ttk.Label(frame, text="Type d'état:") typeEtatLbl.pack(side="left") self.typeEtatCombobox = ttk.Combobox(frame, values=sorted(Etat.getListEtat()), state="readonly") self.typeEtatCombobox.set(self.etat.__class__.__name__) self.typeEtatCombobox.pack(side="left") self.typeEtatCombobox.bind('<<ComboboxSelected>>', self.etatTypeModified) self.etatCaracsFrame = ttk.LabelFrame( frame, text="Caractéristiques de l'état") self.etatCaracsFrame.pack(side="top") self.etatTypeModified() etatOptionFrame = ttk.Frame(frame) cumulMaxLbl = ttk.Label(etatOptionFrame, text="Cumul max:") cumulMaxLbl.grid(row=0, column=0, sticky="e") cumulMaxSpinbox = tk.Spinbox(etatOptionFrame, from_=-1, to=99, width=3) cumulMaxSpinbox.delete(0, 'end') cumulMaxSpinbox.insert(0, int(self.kwargs.get("cumulMax", -1))) cumulMaxSpinbox.grid(row=0, column=1, sticky="w") sortsExclusLbl = ttk.Label(frame, text="Sorts exclus:") sortsExclusLbl.pack(side="left") sortsExclusEntry = ttk.Entry(frame, width=30) sortsExclusEntry.delete(0, 'end') sortsExclusEntry.insert(0, self.sortsExclus) sortsExclusEntry.pack(side="left") remplaceNomFrame = ttk.Frame(frame) remplaceNomLbl = ttk.Label( remplaceNomFrame, text="Remplace le nom de l'état par le sort:") remplaceNomLbl.pack(side="left") remplaceNomVar = tk.BooleanVar() remplaceNomVar.set(self.kwargs.get("kwargs:remplaceNom", True)) remplaceNomCheckbutton = ttk.Checkbutton(remplaceNomFrame, variable=remplaceNomVar) remplaceNomCheckbutton.pack(side="left") remplaceNomFrame.pack(side="bottom") ret["sortsExclus"] = sortsExclusEntry ret["kwargs:cumulMax"] = cumulMaxSpinbox ret["kwargs:remplaceNom"] = remplaceNomVar ret["etat"] = self.etatWidgets etatOptionFrame.pack(side="bottom") frame.pack() return ret