August 5th, 2012, 10:05 AM
Python 3 Tkinter module
I'm trying to create a frame in Python 3's Tkinter module and have a button appear but it doesn't seem to work. Here's my code:
Any ideas on how to fix it?
from tkinter import*;
root = Tk();
self.bttn = Button(self,"text"="I do nothing!");
app = Application(root);
I was already able to get to to run by directly invoking the Frame constructor without defining a class. The problem seems to arise when I try to define a class for my Frame object.
August 5th, 2012, 10:14 AM
The problems have nothing to do with the fact that you're defining your own class. The problems are that you're using a string as a keyword argument on line 13 and that you don't call the grid method in __init__ ("self.grid" doesn't call the method - you need "()" to call a method).
Comments on this post
August 5th, 2012, 10:20 AM
August 5th, 2012, 08:23 PM
In python as in gawk, semi-colon separates statements.
In c, `;' terminates statements.
[/code] are essential for python code and Makefiles!