All Questions

22
votes
5answers
9810 views

Why is Button parameter “command” executed when declared?

My code is: from Tkinter import * admin = Tk() def button(an): print an print 'het' b = Button(admin, text='as', command=button('hey')) b.pack() mainloop() The button doesn't work, it pri...
22
votes
2answers
46654 views

Tkinter: AttributeError: NoneType object has no attribute get

I have seen a couple of other posts on similar error message but couldn't find a solution which would fix it in my case. I dabbled a bit with TkInter and created a very simple UI. The code follows- ...
49
votes
2answers
46949 views

Switch between two frames in tkinter

I have built my first few scripts with a nice little GUI on them, as the tutorials have shown me, but none of them address what to do for a more complex program. If you have something with a 'start ...
48
votes
4answers
32433 views

Interactively validating Entry widget content in tkinter

What is the recommended technique for interactively validating content in a tkinter Entry widget? I've read the posts about using validate=True and validatecommand=command, and it appears that these ...
38
votes
2answers
33845 views

Adding a scrollbar to a group of widgets in Tkinter

I am using Python to parse entries from a log file, and display the entry contents using Tkinter and so far it's been excellent. The output is a grid of label widgets, but sometimes there are more row...
64
votes
7answers
64007 views

Best way to structure a tkinter application

The following is the overall structure of my typical python tkinter program. def funA(): def funA1(): def funA12(): # stuff def funA2(): # stuff def funB(): ...
53
votes
4answers
66850 views

How to create a timer using tkinter?

I need to code a program with Python's tkinter library. My major problem is that I don't know how to create a timer or a clock like hh:mm:ss. I need it to update itself (that's what I don't know h...
83
votes
5answers
94910 views

How do you run your own code alongside Tkinter's event loop?

My little brother is just getting into programming, and for his Science Fair project, he's doing a simulation of a flock of birds in the sky. He's gotten most of his code written, and it works nicely,...
21
votes
1answers
44435 views

Why does Tkinter image not show up if created in a function?

This code works: import tkinter root = tkinter.Tk() canvas = tkinter.Canvas(root) canvas.grid(row = 0, column = 0) photo = tkinter.PhotoImage(file = './test.gif') canvas.create_image(0, 0, image=pho...
77
votes
8answers
110999 views

How to pass arguments to a Button command in Tkinter?

Suppose I have the following Button made with Tkinter in Python: import Tkinter as Tk win = Tk.Toplevel() frame = Tk.Frame(master=win).grid(row=1, column=1) button = Tk.Button(master=frame, text='pre...

Previous Next