small problem here, code seem clean tkinter gui doesn't appear ? can seem figure out. gui / code report form type.
thanks in advance
from tkinter import * class fichedesignalement(frame): def __init__(self): frame.__init__(self) programme = frame() programme.pack(side="top", fill="both", expand=true) programme.grid_rowconfigure(0, weight=5) programme.grid_columnconfigure(0, weight=5) self.pages = {} onepage in (startprogram, informationspage): start_page = onepage(programme, self) self.pages[onepage] = start_page start_page.grid(row=0, column=0, sticky="nsew") self.show_pages(startprogram) def show_pages(self, cont): see_start_page = self.pages[cont] see_start_page.tkraise() class startprogram(frame): def __init__(self, parent, controller): frame.__init__(self, parent, controller) label = label(self, text="fiche de signalement", font=large_font) label.pack(padx=10, pady=10) start_button = button(self, text="commencer", command=lambda: controller.see_page(informationspage)) start_button.pack() class informationspage(frame): def __init__(self, parent, controller): frame.__init__(self, parent, controller) label = label(self, text="informations sur le suspect", font=large_font) label.pack(side="top", fill="both", expand=true, padx=10, pady=10) person_suspected = label(self, text="prenom") person_suspected.grid(row=0, column=0, padx=10, pady=10) first_name = entry(self) first_name.grid(row=0, column=1, padx=10, pady=10) person_suspected_2 = label(self, text="nom") person_suspected_2.grid(row=0, column=2, padx=10, pady=10) last_name = entry(self) last_name.grid(row=0, column=3, padx=10, pady=10) person_height = label(self, text="grandeur") person_height.grid(row=1, column=0, padx=10, pady=10) size_height = entry(self) size_height.grid(row=1, column=1, padx=10, pady=10) person_weight = label(self, text="poids") person_weight.grid(row=1, column=2, padx=10, pady=10) size_weight = entry(self) size_weight.grid(row=1, column=3, padx=10, pady=10) app = fichedesignalement() app.mainloop()
in addition indentation errors , missing import statements , missing definition of large_font
, have problem:
label = label(self, text="informations sur le suspect") label.pack(side="top", fill="both", expand=true, padx=10, pady=10) person_suspected = label(self, text="prenom") person_suspected.grid(row=0, column=0, padx=10, pady=10)
both label
, person_suspected
share same parent (self
), 1 uses pack
, 1 uses grid
. can't use both of them widgets share common parent. must use grid
or pack
.
Comments
Post a Comment