Dieser Fehler kommt:
Form1=FormCreate(application)
TypeError: this constructor takes no arguments
Nun ich weiß nur irgent etwas fehlt aber was fehlt weiß ich nicht.
Hier kriegt ihr mal den code:
Code: Alles auswählen
#!/usr/bin/env python
from Tkinter import *
class FormCreate:
def _init_(self,parent):
panel1=Frame(parent,height=80,width=200)
panel1.pack_propagate(0)
panel1.pack()
button1=Button(panel1,text="Exit",fg="blue",command=parent.quit,font=("System",20))
button1.pack(side=Right,fill=BOTH,expand=1)
button2=Button(panel1,text="Hello",command=self.sayHello,font=("System",20))
button2.pack(side=LEFT,fill=BOTH,expand=1)
panel2=Frame(parent,height=30,width=200)
panel2.pack_propagate(0)
panel2.pack()
self.label1Caption=StringVar()
label1=Label(panel2,textvariable=self.label1Caption,font=("System",16))
label1.pack(side=BOTTOM)
def sayHello(self):
self.label1Caption.set("Hello World !")
##### Start ################
application=Tk()
application.title("Demo")
Form1=FormCreate(application)
application.mainloop()