from Tkinter import *
class Application(Frame):
def __init__(self, master):
Frame.__init__(self, master):
self.grid()
self.create_widgets()
def create_widgets(self):
self.bttn1 = Button(self, text="I do nothing")
self.bttn1.grid()
self.bttn2 = Button(self)
self.bttn2.grid()
self.bttn2.configure(text="Me too!")
self.bttn3 = Button(self)
self.bttn3.grid()
self.bttn3["text"] = "Me also!"
#main
root = Tk()
root.title("Lazy Buttons Again")
root.geometry("200x85")
app = Application(root)
root.mainloop()
GUI programming
Page 1 of 15 Replies - 347 Views - Last Post: 28 December 2012 - 09:28 AM
#1
GUI programming
Posted 27 December 2012 - 08:34 AM
Hi i'm new to python and i just statred learning gui programming with Tkinter and i've stumbled upon a little problem. I'm learnning from an ebook i downloaded and i am trying to replicate a program in that ebook but the program doesn't run i've checked it lots of times but still do not know what is wrong.
Replies To: GUI programming
#2
Re: GUI programming
Posted 27 December 2012 - 08:37 AM
Just to make everyone's life easier, could you please provide a little more information about the exact problem you're having?
Are you seeing error messages from the interpreter? If so, what are they? (just copy the output, don't summarize it!)
If the program doesn't report an error, what does it do, and how is that different from what you expect?
Are you seeing error messages from the interpreter? If so, what are they? (just copy the output, don't summarize it!)
If the program doesn't report an error, what does it do, and how is that different from what you expect?
#3
Re: GUI programming
Posted 27 December 2012 - 08:46 AM
You haven't told us what error message(s) you receive?
Correct this line - without the colon at the end:
The Tkinter library is renamed tkinter in Python 3. Identifiers are case-sensitive in Python.
Correct this line - without the colon at the end:
Frame.__init__(self, master)
The Tkinter library is renamed tkinter in Python 3. Identifiers are case-sensitive in Python.
This post has been edited by andrewsw: 27 December 2012 - 08:50 AM
#4
Re: GUI programming
Posted 27 December 2012 - 08:47 AM
i get no errors when i double clik on the file it simply does not run.(That normally happens when there is an error in my code and it probably will not run till i fill the error). I use IDLE.
#5
Re: GUI programming
Posted 27 December 2012 - 03:49 PM
It worked for me - that is, the form displayed - when I removed the colon mentioned in my previous post.
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote



|