I want to remove a frame from my interface when a specific button is clicked.
This is the invoked callback function
def removeMyself(self):
del self
However, it doesn't remove itself. I'm probably just deleting the object in python without updating the interface ?
thanks
Update
self.itemFrame = tk.Frame(parent)
self.itemFrame....
How can I set the default value of my slider to 100 ?
self.slider = tk.Scale(self.leftFrame, from_=0, to=256, orient=tk.HORIZONTAL, command=updateValue)
thanks
...
Hi everyone,
I've been writing a long GUI in Python using Tkinter. One thing that I don't understand is why I can't bind events to widgets in a loop. In the code below, binding works well if I do it manually (commented out code) but not in a for loop. Am I doing something wrong?
import Tkinter
root = Tkinter.Tk()
b1 = Tkinter.Button(...
I'm trying to convert a basic tkinter GUI program to an .exe using py2exe. However I've run into an error using the following conversion script.
# C:\Python26\test_hello_con.py py2exe
from distutils.core import setup
import py2exe
setup(windows=[r'C:\Python26\py2exe_test_tk.py'])
C:\Python26\py2exe_test_tk.py is the following code
...
I'm using the slider to update my visualization, but the command updateValue is sent everytime I move the slider thumb, even for intermediate values.
Instead I want to trigger it only when I release the mouse button and the interaction is complete.
self.slider = tk.Scale(self.leftFrame, from_=0, to=256, orient=tk.HORIZONTAL, command=up...
What's the main difference between the 2 GeometryManagers in TKinter, grid() and pack()
what do you use for your projects ?
If grid is better to align object, what the main purpose of pack?
thanks
...
What does this error message mean ?
AttributeError: 'NoneType' object has no attribute 'tk'
thanks
...
how can I set width to a tk.Frame (post-initialization ?)
In other words, is there a member function to do it ? Sometheing like frame.setWidth()
thanks
...
How can I trigger and listen for events in python ?
I need a practical example..
thanks
Update
#add Isosurface button
def addIso():
#trigger event
self.addButton = tk.Button(self.leftFrame, text="Add", command=addIso) #.grid(column=3, row=1)
self.addButton.pack(in_=self.leftFrame, side="right", pady=2)
...
In which kind of application is TKinter usually used ?
I'm doing a project in python in which I'm using it for the first time to build a simple user interface.
I was wondering if this is widely used for specific applications, or mobile applications.. etc
thanks
...
Every time I use this code in my applications:
tkMessageBox.showinfo("Test", "Info goes here!")
a message box pops up (like it is supposed to), but after I click OK, the box disappears along with most of the other widgets on the window. How do I prevent the other widgets from disappearing?
Here Is My Code:
from Tkinter import *
im...
I'm creating a GUI using Tkinter/ttk in Python 2.7, and I'm having an issue where a Frame will resize itself once a widget is placed inside of it. I am new to Python and haven't used Tkinter before.
example:
ROOT = Tk()
FRAME = ttk.Frame(ROOT, width=300, height=300, relief='groove')
FRAME.grid()
ROOT.mainloop()
will produce a groo...
Python 2.7 (32-bit) Windows: We're experimenting with Python 2.7's support for themed Tkinter (ttk) for simple GUI's and have come away very impressed!! The one area where the new theme support seems to have come up short is how OS specific common dialogs are wrapped.
Corrected: In other words, the MessageBox and ColorChooser common dia...
What is the most used of these library and why ?
What are the differences ?
...
How can I dynamically change the background color of a button in Tkinter ?
It only works when I initialize the button:
self.colorB = tk.Button(self.itemFrame, text="", bg="#234", width=10, command=self.pickColor)
I've tried this:
self.colorB.bg = "#234"
but it doesn't work..
thanks
...
Python 2.7 under Windows: How can we control the position of Tkinter's common dialogs?
Here's what we've discovered:
Certain common dialogs always open up relative to their parent window
Certain common dialogs always open up centered on the user's desktop
All common dialogs appear to ignore the optional parent= parameter
Questions:
...
I am writing a small diagram drawing application (similar to Graphviz in spirit), and need a GUI library that would allow me to embed a canvas capable of drawing anti-aliased lines and text. I want to have a text editor in one half of the window to edit the diagram code and a (perhaps live) preview pane in the other.
Right now I have th...
I have a label sitting on a frame which is updated periodically to show the status of the application. Periodically, the name of the item being processed will not fit into the window, and with the way I currently have the label configured the window expands to accomidate the label.
Ideally, I'd like way to smartly truncate the text o...
I have a clock I made and I'd like to make it an alarm clock.
...
I'm experimenting with the new ttk Tile enhancements that ship with Python 2.7.
Windows 7: The code below demonstrates how the combobox dropdown shows up BEHIND our root window when the root window is configured as a topmost window ("always on top"). If you comment out the line """ root.attributes( '-topmost', 1 )""" then the combob...