Hi,
I’ve writen a little python script that just pops up a message box containing the text passed on the command line. I want to pop it up only when the window —resulting from a previous call— is not open.
from Tkinter import *
import tkMessageBox
root = Tk()
root.withdraw()
# TODO not if a window with this title exists
tkMessageBox...
I create a new Button object but did not specify the command option upon creation. Is there a way in Tkinter to change the command (onclick) function after the object has been created?
...
How do I end a Python Tkinter program? Let's say I have this code:
from Tkinter import *
def quit():
???
root = Tk()
Button(root, text="Quit", command=quit).pack()
root.mainloop()
How should I define the quit() routine?
...
How do I handle the window close event (user clicking the 'X' button) in a Python Tkinter program?
...
I want to create some text in a canvas:
myText = self.canvas.create_text(5, 5, anchor=NW, text="TEST")
Now how do I find the width and height of myText?
...
I want to put a canvas with an image in my window, but then I want to pack() widgets over top of it so the canvas acts as a background. Is it possible to have two states for the pack() manager, one for one set of widgets and another for another set?
...
I have a Tix.ComboBox with an editable text field. How do I force the variable holding the value for the text to update?
Let me give a more concrete explanation. I have a combo box and a button. When I click the button, it pops up a message box with the value of the combo box. Let's say the combo box text field currently has the value "...
After a bind a method to an event of a Tkinter element is there a way to get the method back?
>>> root = Tkinter.Tk()
>>> frame = Tkinter.Frame(root, width=100, height=100)
>>> frame.bind('<Button-1>', lambda e: pprint('Click')) # function needed
>>> frame.pack()
>>> bound_event_method = frame.???
...
Does anyone know if it is possible (and if yes, how) to bind an event (Python + Tkinter on MS Windows) to a system date change?
I know I can have .after events checking once in a while; I'm asking if I can somehow have an event fired whenever the system date/time changes, either automatically (e.g. for daylight saving time) or manually....
Hey,
I'm writing some code in python and I'm having trouble when trying to retrieve content of an Entry widget.
The thing is: I want to limit the characters that can be typed, so I'm trying to clear the Entry widget when I reach the specific number of characters (2 in this case), but it looks like I always miss the last typed character....
Hey,
I'm building a code in which I'd like to be able to generate an event when the user changes the focus of the cursor from an Entry widget to anywhere, for example another entry widget, a button...
So far i only came out with the idea to bind to TAB and mouse click, although if i bind the mouse click to the Entry widget i only get m...
I installed Python 2.6 for one user on Windows Vista. Python works okay, but when I try: import Tkinter, it says the side-by-side configuration has errors. I've tried tinkering with the Visual Studio runtime, with no good results. Any ideas on how to resolve this?
...
How do you invoke a tKInter event from a separate object? I'm looking for something like wxWidgets wx.CallAfter. For example, If I create a child object and pass it my root Tkinter.Tk() and then try to call a method of that root window from the child object my app locks up.
The best I can come up with is to use the .after method and...
Having played around a little with both Tkinter and wxPython, I like Tkinter much better in terms of how clean my source code looks. However, it doesn't seem to have as many features; in particular it doesn't have tabs (as in, the tabs at the top of a Firefox window).
A little Googling on the subject offers a few suggestions. There's ...
I've recently starting playing around with Tix in Python, and I'm distressed at the lack of Python documentation for it online. Both the tutorial and book have plenty of code examples in Tcl and none in Python. Googling has turned up no good Python docs.
What do Tix users do for their Python documentation? Do they just learn to read ...
I was trying to write code that would auto-close a Toplevel Tk window in Python.
I ended up getting it to work, but ran into a little problem along the way that I wasn't able to figure out.
The second two buttons work, but the first one doesn't and I don't understand why...
Any ideas?
from Tkinter import *
root = Tk()
def doDestroy ...
I've created a very simple app, which presents an easygui entrybox() and continues to loop this indefinitely as it receives user input.
I can quit the program using the Cancel button as this returns None, but I would also like to be able to use the standard 'close' button to quit the program. (ie. top right of a Windows window, top left...
I want to spawn another process to display an error message asynchronously while the rest of the application continues. I'm using the multiprocessing module in Python 2.6 to create the process and I'm trying to display the window with TKinter. This code worked okay on Windows, but running it on Linux the TKinter window does not appear if...
I have some Tkinter canvas and some picture of lines and text on it. Is there an easy way to copy it to a clipboard?
...
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, but the birds need to move every moment.
Tkinter, however, hogs the time for its own event loop, and so his code won't run. Doing root.ma...