472,334 Members | 1,523 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,334 software developers and data experts.

Re: [Tkinter-discuss] WxPython -> Tkinter

On 10/29/08, Olrik Lenstra <o.*******@gmail.comwrote:
Hello everyone,

A while ago I joined the Tutor mailing list, and they helped me out with a
question regarding wxPython.
Now however, I have tried a program in Tkinter and I would like to see if
there is a similar command to "wx.SafeYield(self, True)".
It will be a combination of commands, not a single one. Initially I
considered this as "probably without solution", since tcl acquired a
yield command just in the 8.6a3 release, but then I looked at
wx.SafeYield code and apparently it is possible to replicate it.

Here is an initial cut, it is very possible to contain something not
equivalent to wx.SafeYield (besides it could be improved):
import ttk

inside_tkyield = False
disabled_wins = {}

def safe_yield(window, only_if_needed=False):

return tk_yield(window, only_if_needed)
for widget, flags in disabled_wins.iteritems():
ttk.Widget.state(widget, flags)
def window_disabler(window):
widgets = window.children.values()

for widget in widgets:
if widget.instate(['!disabled']):
prev_flags = widget.state(['disabled'])
disabled_wins[widget] = prev_flags
def tk_yield(window, only_if_needed=False):
# wx implements this differently based on the backend it is using
global inside_tkyield
if inside_tkyield:
if not only_if_needed:
raise RuntimeError("safe_yield called recursively")

return False

inside_tkyield = True;


inside_tkyield = False;

return True
Note that this depends on ttk widgets
(http://pypi.python.org/pypi/pyttk) since it uses widget.state to
disable and reenable the widgets. On windows the "wm" command supports
disabling the entire window, so it is easier if you can use it.
Below is a copy of the message to the tutor list.
Dear Mailing list,

a while ago a few of you helped me solve an issue I had with a GUI / scan
program that I made.
The problem was that when I tried to move the frame it would hang until
scan was finished.
To solve this I had to add "wx.SafeYield(self, True)" to the scan and the
GUI wouldn't hang any more.
Now I have redone the program and have written it with Tkinter instead of

So is there a similar command for Tkinter as there is for WxPython?

Thanks in advance.

Tkinter-discuss mailing list

-- Guilherme H. Polo Goncalves
Oct 29 '08 #1
0 1663

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: BJörn Lindqvist | last post by:
See: http://www.wxpython.org/quotes.php. especially: "wxPython is the best and most mature cross-platform GUI toolkit, given a number of...
by: Erik Johnson | last post by:
I am looking for some input on GUI libraries. I want to build a Python-driven GUI, but don't really understand the playing field very well. I have...
by: It's me | last post by:
I've built a Python application using PythonCard 1.9 and Python 2.3 running under Windows XP. Everything works except that when I use the keyboard...
by: Tuvas | last post by:
Is there a way to put an image loaded from PIL into a TKinter GUI? Without converting the image to a .bmp, and using a canvas? If that's the only...
by: Anastasios Hatzis | last post by:
I'm looking for a pattern where different client implementations can use the same commands of some fictive tool ("foo") by accessing some kind of...
by: Kevin Walzer | last post by:
I'm porting a Tkinter application to wxPython and had a question about wxPython's event loop. The Tkinter app provides a GUI to a command-line...
by: whatazor | last post by:
Hi all, I migrate some code from tkinter to wxpython. I need the equivalent Tkinter method Tkinter.Tk.after in wxPython, but I'm not able to find...
by: Sean DiZazzo | last post by:
Is there something special you have to do to get a wxPython app to run remotely under xwindows? My Tkinter apps always automatically work that...
by: Guilherme Polo | last post by:
On 10/29/08, Guilherme Polo <ggpolo@gmail.comwrote: oops, wrong list. -- -- Guilherme H. Polo Goncalves
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.