February 23rd, 2005, 01:38 PM
-
Tkinter
Hey i dont know if i should open another thread or just post my question here.
But oh well here u go.
I am also doing Tkinter at the moment and i am just reading for the most part.
But i dont understand how to make a function and then the variables assigning.
For example: ###This is a script i got from a website.
from Tkinter import *
class Application(Frame):
def say_hi(self):
print "hi there, everyone!"
def say_bye(self):
print "Bye everyone."
def createWidgets(self):
self.QUIT = Button(self)
self.QUIT["text"] = "QUIT"
self.QUIT["fg"] = "red"
self.QUIT["bg"] = "blue"
self.QUIT["command"] = self.quit
self.QUIT.pack({"side": "left"})
self.hi_there = Button(self)
self.hi_there["text"] = "Hello",
self.hi_there["command"] = self.say_hi
self.hi_there.pack({"side": "left"})
def __init__(self, master=None):
Frame.__init__(self, master)
self.pack()
self.createWidgets()
app = Application()
app.mainloop()
### These functions do not have anything to assign but how would i be able that the user assigns them and then I apply them to my function.
For example:
class Plus:
def plusx(x,y):
print x+y # How would i assign these variables
def __init__(self):
...
Edit/Delete Message