473,503 Members | 1,731 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Running user scripts in a Tkinter app?

I have a Python/Tkinter remote control application and want to add
support for running user scripts.

I would like the scripts to be written in python, would like them to be
able to update Tkinter widgets and (the hard part) would also like them
to be capable of pausing until some condition is met (e.g. a remote
control command finishes) without hanging the event loop.

I plan to add a library of routines to send commands and wait for
specific replies. For example:
- call(cmd) sends a command string to the remote host and returns a
"command object" that keeps track of the state of the command
- waitcmd(cmd_obj) pauses the script (but not the overall application)
until cmd_obj finishes or fails

I'm confused as to the best way to write the "waitcmd" function. It
seems like a good place to use threads, but my understanding is that
Tkinter is not thread safe.

The only solution I've thought of is to try to recreate the Tkinter main
loop within the wait function. Very crudely:

tkobj = Tkinter.Frame()

def waitcmd(cmd_obj):
while not cmd_obj.isdone():
tkobj.update()

I think this will work, but am worried it will be much slower than the
usual Tkinter main event loop. If there was some way to start a new
Tkinter event loop (while the main loop is paused) and terminate this
new loop when the wait was finished, that'd be perfect.

Any suggestions? Would this be easier in some other GUI library?

-- Russell
Jul 18 '05 #1
0 1303

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

Similar topics

1
2080
by: wolf | last post by:
i have without any success tried hard to get python scripts running under apache on windows using fastcgi. it is totally unclear to me what role the adaption script...
11
4960
by: Maxim Kasimov | last post by:
Hi. Are there widely used and recommended Python libraries that will let me makes a portable text user interface? -- Best regards, Maxim
1
2007
by: chris.levis | last post by:
All: I have written a Python webapp under MS IIS 5.0 that does the following: -Does a CVS checkout of a particular bit of xml -Gets a list of valid cvs tags for that xml file -Based on user...
3
1381
by: Jim Anderson | last post by:
I have just installed Fedora Core 3 on my pc. Python runs fine, but when I try to run tkinter the tkinter library is not found. I tried installing python 2.4.1 and could not get tkinter to run...
17
4808
by: JStemper | last post by:
On one of my localhost sites I'm getting a message to run aspnet_regiis -c to correct some scripting issues. When I try to run the listed command I get another error: "You must have...
0
1664
by: paulhjwu | last post by:
Hi, I have problems running a couple of shell scripts from PHP. I found a similar posting, so I posted my question to the original author. But unfortunately the original author is not at the...
2
4847
by: Dave Hughes | last post by:
Just noticed something rather annoying after upgrading my test box (a Linux server running DB2 UDB v8 for LUW) to fixpak 11 (for reference it was previously on fixpak 7). In the past I've relied...
2
2311
by: jim-on-linux | last post by:
py help, The file below will run as a stand alone file. It works fine as it is. But, when I call it from another module it locks my computer, The off switch is the only salvation. This...
9
2450
by: Frank Potter | last post by:
I want to find a multithreaded downloading lib in python, can someone recommend one for me, please? Thanks~
0
7087
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7281
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7334
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6993
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7462
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5014
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3156
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
737
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
383
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.