473,624 Members | 2,275 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help on multithreading and Tkinter; Linux vs Windows

Hello

I have an application running several thread to display some financial
data;
basically I have a thread displaying HTML tables by means of Tkhtml,
another implementing a scrolling ticker based on a Text widget with
embedded windows and a thread running the Tkinter mainloop plus
several other thread dealing with the scheduling of the contents and
the acquisition of data but not using graphic widgets.
I run the same code on Linux and Windows; I have no problems on Linux
while on Windows everything get stucked when I tried to scroll the
ticker, it looks like I'm blocked in mywidget.xview( SCROLL,1,UNITS) ;
at this time the graphic of the application freezes while all the rest
goes on running.
I tried several other strategies, like having the ticker thread and
the table displaying thread sending event to the mainloop to perform
Tkinter methods call in callbacks instead of calling the methods
themselves, but nothing seems to change. If I run root.update() after
scrolling the ticker, I can see it moving a bit, but after some loops,
I get the same frozen status.

Is there anyone who can help me? I've already tried the
Tkinter-discuss mailing list but I got no answer.
I supposed Tkinter worked the same way under Windows and Linux but it
does not look like it's so; is there any paper explaining the
differences between the behaviour on the two operating systems? For
instance on Windows I also had problem with iconify and with the
button highlight, which is Windows standard whatever setting you try.

Any help is really appreciated.

Thanks in advance

Corrado Clementi
Jul 18 '05 #1
1 3845
corrado wrote:
Hello

I have an application running several thread to display some financial
data;
basically I have a thread displaying HTML tables by means of Tkhtml,
another implementing a scrolling ticker based on a Text widget with
embedded windows and a thread running the Tkinter mainloop plus
several other thread dealing with the scheduling of the contents and
the acquisition of data but not using graphic widgets.
I run the same code on Linux and Windows; I have no problems on Linux
while on Windows everything get stucked when I tried to scroll the
ticker, it looks like I'm blocked in mywidget.xview( SCROLL,1,UNITS) ;
at this time the graphic of the application freezes while all the rest
goes on running.
Like many other GUI toolkits, it seems that Tkinter doesn't like to be called
from several threads in the same application. The fact that it works on Linux is
what is suprising to me: I already tried to do a similar thing on Linux and
finally gave up, because I experienced many lock-ups like you do.

The solution is always the same: use only one thread to manage the GUI,
preferably the main one, and use a combination of Tkinter GUI events posted via
event_generate and Queue's to pass information from secondary threads to the
GUI. It messes up the code a bit, but it's the only way we've found to avoid the
lock-up's you're experiencing.

[snip] Is there anyone who can help me? I've already tried the
Tkinter-discuss mailing list but I got no answer.
I supposed Tkinter worked the same way under Windows and Linux but it
does not look like it's so; is there any paper explaining the
differences between the behaviour on the two operating systems? For
instance on Windows I also had problem with iconify and with the
button highlight, which is Windows standard whatever setting you try.


Try the tcl/tk documentation at http://www.tcl.tk/man ; it of course describes
the tcl commands corresponding to the Tkinter classes and methods, but has much
more details about the differences between the supported platforms than any
Tkinter documentation I know. But you're touching quite a deep problem here: the
mix of GUI and threads is a tough issue, and the problems you experience may
depend not only on tk or Tkinter, but also on how Python manages threads and how
the underlying system supports them. I fear your best source of info on this
matter will be newsgroups like this one...

HTH
--
- Eric Brunel <eric (underscore) brunel (at) despammed (dot) com> -
PragmaDev : Real Time Software Development Tools - http://www.pragmadev.com

Jul 18 '05 #2

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

Similar topics

0
3594
by: wang xiaoyu | last post by:
Hello,everyone. my program runs well in windows,i use tkSimpleDialog to receive some input,but when i copy my program into Linux RH8.0,entrys in my tkSimpleDialog derived Dialog have a vital problem:only one entry can receive key event,'tab' key to navigate between entrys is not valid too,when i use mouse to focus a entry(which can not navigate through 'tag' key),no matter what key i pressed the entry receive no reply.But in window they...
2
3363
by: Dennis Sylvester | last post by:
Interested in any opinions, studies, etc., concerning the GUI tool(s) to use for Python. Specifically, which would you recommend (and why) for building GUI apps in Python: TKinter BOA PyQT Thanks, Dennis
3
2725
by: anuradha.k.r | last post by:
hi, Have a problem in python installation.I have already installed python 2.2 in my linux machine,but i guess tkinter packages were not selected then.Now i want to use tkinter as an interface for my program(actually i wanted to check if my python program written in windows side works fine on linux side also). is there any way i can include the tkinter packages?if so where can i find those files? pls help. thanx,
7
11895
by: SeeBelow | last post by:
Do many people think that wxPython should replace Tkinter? Is this likely to happen? I ask because I have just started learning Tkinter, and I wonder if I should abandon it in favor of wxPython. Mitchell Timin -- "Many are stubborn in pursuit of the path they have chosen, few in
7
4361
by: Justin Ezequiel | last post by:
What font is Tkinter using for displaying utf-8 characters? On my Windows XP, most of the characters with names (unicodedata.name) are displayed WYSIWYG. However, on my Mandrake (warning: Linux newbie), most characters are displayed as \u???? where ???? is the Hex code. ## start of script Tkinter_gui.py---------- import Tkinter import ScrolledText
2
3586
by: Mark English | last post by:
Is there a safe way to run tkinter in a multithreaded app where the mainloop runs in a background thread ? Here's some test code demonstrating the problem. I'm running Python2.4 under Windows 2000. ----------------Code snip starts------------- from Tkinter import * def GetTkinterThread():
4
3042
by: peter | last post by:
I've come across a weird difference between the behaviour of the Tkinter checkbox in Windows and Linux. The issue became apparent in some code I wrote to display an image in a fixed size canvas widget. If a checkbox was set then the image should be shrunk as necessary to fit the canvas while if cleared it should appear full size with scrollbars if necessary. The code worked fine under Linux (where it was developed). But under Windows,...
13
3350
by: Daniel Fetchinson | last post by:
Was looking at PEP 3108, http://www.python.org/dev/peps/pep-3108/ , Is it just me or others also think that it would be a major loss to remove tkinter from the python core? PEP 3108 starts off with: Each module to be removed needs to have a justification as to why it should no longer be distributed with Python. then goes on with,
42
2557
by: =?ISO-8859-1?Q?Tom=E1s_=D3_h=C9ilidhe?= | last post by:
I'm currently writing a program and I've got in mind to keep it as portable as possible. In particular I want it to run on Linux and Windows, but I'm also keeping an open mind to any machine that has a screen and is capable of Ethernet networking. The program requires three things that aren't available in the C Standard: 1) Coloured text (for a console application) 2) Raw socket networking 3) Multithreading For number 1, I've already...
0
8177
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8488
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7170
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6112
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5570
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4183
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2611
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1793
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1488
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.