Siehe Buch "Python and Tkinter Programming" von Manning oder
http://www.manning.com/grayson/Grayson1.zip
Nun, ich habe hier mehrer Buttons am Fensterrand.
Wenn ich nun auf Button1 drücke, soll eine eigene Klasse welche in einer eigenen Datei steht dargestellt werden, wenn ich nun auf Button2 zwei drücke - nun analog zu Button1.
Mein Problem ist nun, daß ich zwar keine Fehler erhalte, jedoch auch nichts passiert.
Der Aufruf von Button ein siet so aus
Code: Alles auswählen
def dooption(self):
self.frmoption = option.optionForm(self.form)
Code: Alles auswählen
from Tkinter import *
class optionForm:
def __init__(self, master):
frame = Frame(master, takefocus=1, highlightthickness=2, highlightcolor='blue')
Label(frame, text=' ').grid(row=0, column=0, sticky=W)
Label(frame, text=' ').grid(row=0, column=5, sticky=W)
self.B1=self.mkbutton(frame, 'B1', 1)
self.B2=self.mkbutton(frame, 'B2', 2)
self.B3=self.mkbutton(frame, 'B3', 3)
self.B4=self.mkbutton(frame, 'B4', 4)
def mkbutton(self, frame, button, column, action=None):
button = Button(frame, text=button, highlightthickness=2)
button.grid(padx=10, pady=6, row=0, col=column, sticky=NSEW)
if action:
button.config(command=action)
return button