I made a GUI with Tkinter, now how do I make it so when a key command will execute a command even if the Tkinter window is not in focus? Basically I want it so everything is bound to that key command.
Example:
Say I was browsing the internet and the focus was on my browser, I then type Ctrl + U. An event would then run on my program....
I have a list of n Entry widgets. The user should be able to type only the following charaters: "V", "F", " ". If the user types one of those characters, the focus should pass from Entry #x to Entry #x+1, otherwise the focus should stay where it is (on Entry #x) and the input should be discarded.
I am not able to discard the wrong input...
How do I create a class called rectangle that I can pass it the coordinates and a color and have it fill those one?
from Tkinter import *
master = Tk()
w = Canvas(master, width=300, height=300)
w.pack()
class rectangle():
def make(self, ulx, uly, lrx, lry, color):
self.create_rectangle(ulx, uly, lrx, lry, fill=color)
re...
My question is similar to here, I would like to be able to swap out an image on a Tkinter label, but I'm not sure how to do it, except for replacing the widget itself.
Currently, I can display and image like so:
import Tkinter as tk
import ImageTk
root = tk.Tk()
img = ImageTk.PhotoImage(Image.open(path))
panel = tk.Label(root, image =...
I would like to have a Dropdown Menu in Tkinter, that includes the shortcut key associated with this command. Is this possible?
EDIT: How would I also add the underline under a certain character, to allow for Alt-F-S (File->Save)?
...
I have a list of n Entry widgets. Every widget accepts only one character, and then the focus is passed to the next one. I would like to ".get()" the values of the n widgets, but I can't get the last one. Here is the sample code:
import Tkinter as tk
def vf(event):
actual=entrylist.index(root.focus_get())
print "--",len(entryli...
I am trying to build a GUI in Python using Tkinter. My idea is to build several Frames inside the root Frame. I can get 2 Frames to appear, but the third Frame overlays the second Frame. I've tried both pack() and grid() as the layout manager in the root Frame.
I want to have a "Stuff At The Top" Frame and a "Stuff At The Bottom" Fra...
So, I want to bind self events after Text widget bind it and change text in widget. Usual 'bind' is called before the content in Text widget changes.
Sorry for my poor English
...
Hello,
I'm working on a gui and I'd like to know how to adjust the size of the menus of a frame in order to have them take all the horizontal space of the frame.
The problem has changed : now the menu buttons are ok when the window is in normal size but when I resize it the menu buttons drop in the middle of the window. How can I make...
Hello,
I'm working on a Gui and I'd like to know if it is possible to make the menu property of a window a separate class on my script for a clearer and more enhancement prone code.
my code currently is :
class Application(Frame):
""" main window application """
def __init__(self, boss = None):
(...)
self.menu = Menu(self)...
Hello,
I'm working on a Gui and I'd like to know how to create a class that would implement frame.
e.g.
class WindowContent(Tkinter.?)
""" This class would create a frame for my program window """
class App(Tkinter.Tk):
""" main window constructor """
def __init__(self):
Tkinter.Tk.__init__(self)
program...
What Python-related code (PyGTK, Glade, Tkinter, PyQT, wxPython, Cairo, ...) could you easily use to create a GUI to do some or all of the following?
Part of the GUI has an immovable square grid.
The user can press a button to create a resizable rectangle.
The user can drag the rectangle anywhere on the grid, and it will snap to the gr...
I have a fairly large work project that uses pygtk for the GUI and I need reduce the dependencies and convert to tkinter.
Does anyone know of a script to convert exisiting pygtk code to tkinter?
...
At program startup, I add some items to my listbox like this:
for widget in WidgetNames:
listbox.insert(0, widget)
WidgetNames is obviously a list of some items, e.g. "Button" and "Canvas". The thing is, the listbox doesn't show the items that are added with above code. However,
for widget in WidgetNames:
listbox.insert(0, w...
The matplotlib code is in http://matplotlib.sourceforge.net/examples/animation/strip_chart_demo.html
I want to embed this code in my tkinter GUI,what should I do ? As it say"""This example uses gtk but does not depend on it intimately. It just uses the idle handler to trigger events. You can plug this into a different GUI that support...
I'm writing a Tkinter GUI in Python. It has an Entry for searching with a results ListBox below it. The ListBox also has a Scrollbar. How can I get scrolling with the mouse and arrow keys to work in the ListBox without switching focus away from the search field? IE I want the user to be able to type a search, scroll around, and keep typi...
I have a Python script which uses Tkinter for the GUI. My little script should create a Toplevel widget every X seconds. When I run my code, the first Toplevel widget is created successfully, but when it tries to create a second one the program crashes.
What I am doing is using the after method to call the function startCounting every ...
Is there a command similar to "wm_overrideredirect" for Ubuntu? I want My program to be displayed without the standard window.
...
I have an existing python script and I want to wrap it in a GUI. Since I already have tkinter installed I would like to use it if possible. At the moment my script has many places where it asks for user input using raw_input(). I would like to replace these with either a modal pop-up asking for user input or (preferably) an Entry obje...
TL.attributes('-toolwindow', True)
I'm making a GUI in Tkinter that uses a tool window, is there anyway to make this window show up in the task bar?
...