diff --git a/tk_first_steps/feet_classes_mvc.py b/tk_first_steps/feet_classes_mvc.py index 23d98f9..47d3eb6 100644 --- a/tk_first_steps/feet_classes_mvc.py +++ b/tk_first_steps/feet_classes_mvc.py @@ -125,10 +125,19 @@ class FeetToMeter(Tk): self.title("Feet to Meters") + # Textvariablen, um Inhalte der Eingabefelder zu kontrollieren + self.feet = StringVar() + self.meters = StringVar() + # Event Handler (Validator) registrieren self.check_entry_wrapper = self.register(self.validator.check_entry) + # Zugriff auf Stilinformationen self.s = ttk.Style() + # Zugriff auf Statusleiste + self.frame_statusbar = ttk.Frame(self) + + # Aufbau des Fensters self.create_styles() self.create_widgets() self.bind_events() @@ -157,7 +166,6 @@ class FeetToMeter(Tk): self.rowconfigure(0, weight=1) # Eingabefeld für Länge in feet - self.feet = StringVar() feet_entry = ttk.Entry(mainframe, width=7, textvariable=self.feet, validatecommand=(self.check_entry_wrapper, '%P'), validate='key') @@ -173,7 +181,6 @@ class FeetToMeter(Tk): ttk.Label(mainframe, text="Meter").grid(column=3, row=2, sticky=W) # Ausgabefeld für Länge in Metern - self.meters = StringVar() meters_entry = ttk.Entry(mainframe, width=7, textvariable=self.meters) meters_entry.grid(column=2, row=2, sticky=(W, E)) meters_entry.configure(state='readonly') # keine Eingabe, aber selektierbar @@ -188,13 +195,12 @@ class FeetToMeter(Tk): child.grid_configure(padx=5, pady=5) # Statusbar - - self.frame_statusbar = ttk.Frame(self) - self.frame_statusbar['relief'] = 'sunken' - self.frame_statusbar['height'] = 12 - self.frame_statusbar['style'] = 'aFrame.TFrame' - self.frame_statusbar.grid_propagate(0) # Feste Größe an Grid-Packer weitergeben - self.frame_statusbar.grid(column=0, row=1, sticky=W + S + E) + st = self.frame_statusbar + st['relief'] = 'sunken' + st['height'] = 12 + st['style'] = 'aFrame.TFrame' + st.grid_propagate(0) # Feste Größe an Grid-Packer weitergeben + st.grid(column=0, row=1, sticky=W + S + E) # Setze Fokus in Eingabefeld feet_entry.focus()