1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
|
class tst (Tk):
def __init__(self):
# superclass inits
Tk.__init__(self)
# main window inits
self.title("test")
self.geometry("530x350")
self.resizable(width=False, height=False)
# widget inits
self.init_widget()
# end def
def init_widget (self):
"mise en place de l'interface GUI"
# init menu
self.init_menu()
# init mainframe - conteneur principal
self.mainframe = Frame(self)
self.mainframe.grid(row=0, column=0, sticky=NW+SE, padx=5, pady=5)
self.init_exploiter()
def init_exploiter(self):
# init frame
_frame = self.frame_exploiter = Frame(self.mainframe)
# init notebook
_nbk = ttk.Notebook(_frame)
_nbk.pack(expand=1, fill=BOTH)
# init tab
_tab2 = ttk.Frame(_nbk, padding="10")
scroll = Scrollbar(_tab2)
scroll.pack(side = RIGHT,fill = Y)
_nbk.add(_tab2, text="Resultat", sticky=NW)
def exploiter (self):
"lire bdd"
self.switch_to(self.frame_exploiter)
# end def
def switch_to (self, content):
"basculer vers un autre contenu"
for widget in self.mainframe.winfo_children():
widget.pack_forget()
# end for
# on affiche le nouveau contenu
content.pack(expand=1, fill=BOTH, in_=self.mainframe)
# end def
# end class tst
if __name__ == "__main__":
tst().mainloop()
# end if |
Partager