473,765 Members | 2,172 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Tkinter in thread hangs on windows but not on Linux

Hi,

I need to pop-up in a "modless" manner some windows from an existing
Tkinter loop. The following code works OK under Linux: the second window
opens, shows the information, and quits cleanly when destroyed. However,
under windows, I get the second window without the content (so I hang in
run I guess), and both the thread and the calling process hang.

Any clue ?

Thanks
Philippe

#************** *************** *************** *************** *************** *****
class SC_DOCS(threadi ng.Thread):
__m_smg = None
__m_title = None
def __init__(self,p _msg,p_title):
threading.Threa d.__init__(self )
self.__m_msg = p_msg
self.__m_title = p_title

#************** *************** *************** *************** *************** *****
def run (self):
l_r = Tk()
l_r.title(self. __m_title)
l_f = Frame(l_r)
l_f.pack(side=T OP, expand=YES, fill=BOTH)
l_st = ScrolledText(l_ f)
l_st.pack(side= TOP, expand=YES, fill=BOTH)
l_st.insert(END ,self.__m_msg)

l_r.mainloop()
..
..
..

l_d = SC_DOCS('A MESSAGE', 'A TITLE')
l_d.start()
..
..
..
--
*************** ************
Philippe C. Martin
SnakeCard LLC
www.snakecard.com
*************** ************

Jul 18 '05 #1
3 1806
This example worked for me on Windows 2000, after inserting

import threading
from Tkinter import *
import ScrolledText
at the top.

Jul 18 '05 #2
Well this is what is on the top of my script:
from Tkinter import *
import threading
from ScrolledText import *

I still hang under XP .... wish I had 2K to test.

I almost sounds like tkinter does not get refresh events anymore.

I'll keep at it



On Tue, 18 Jan 2005 12:42:21 -0800, Kamilche wrote:
This example worked for me on Windows 2000, after inserting

import threading
from Tkinter import *
import ScrolledText
at the top.


Jul 18 '05 #3
Actually, the following link:
http://www.astro.washington.edu/owen...erSummary.html
seems to say my code is illegal - so I'm now just launching a modless
window from the main thread - _seems_ to work


On Tue, 18 Jan 2005 11:45:28 +0100, Philippe C. Martin wrote:
Hi,

I need to pop-up in a "modless" manner some windows from an existing
Tkinter loop. The following code works OK under Linux: the second window
opens, shows the information, and quits cleanly when destroyed. However,
under windows, I get the second window without the content (so I hang in
run I guess), and both the thread and the calling process hang.

Any clue ?

Thanks
Philippe

#************** *************** *************** *************** *************** *****
class SC_DOCS(threadi ng.Thread):
__m_smg = None
__m_title = None
def __init__(self,p _msg,p_title):
threading.Threa d.__init__(self )
self.__m_msg = p_msg
self.__m_title = p_title

#************** *************** *************** *************** *************** *****
def run (self):
l_r = Tk()
l_r.title(self. __m_title)
l_f = Frame(l_r)
l_f.pack(side=T OP, expand=YES, fill=BOTH)
l_st = ScrolledText(l_ f)
l_st.pack(side= TOP, expand=YES, fill=BOTH)
l_st.insert(END ,self.__m_msg)

l_r.mainloop()
.
.
.

l_d = SC_DOCS('A MESSAGE', 'A TITLE')
l_d.start()
.
.
.


Jul 18 '05 #4

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

Similar topics

0
3077
by: Bruce Davis | last post by:
I'm having a problem on windows (both 2000 and XP) with a multi-threaded tkinter gui application. The problem appears to be a deadlock condition when a child thread pops up a Pmw dialog window in the context of a main window. The problem does not occur on HPUX or Linux. The following simple example code illustrates the problem and the work around I've come up with; However, I'd like, very much, to get rid of the kludgy work around....
2
6242
by: Michael Schutte | last post by:
I know, questions about Tkinter and threads have been answered very often, but I want to ask anyway. I am using Python 2.2 on a Linux (SuSE Linux 8.1) system. I want to write a server application; like telnet is a client. The user should be able to bind() to a port and wait for a client. The written and recieved data is stored in a Text widget, self.__text. The accept()ing is done in a seperate thread (using the threading module), in...
3
2332
by: Bob Greschke | last post by:
I have a program where the user pushes a button, a "starting" message is ..inserted to a text field with an associated scroll bar, a thread is started that inserts a "working..." message on to the end of the text field until stopped, or until the loop finishes. The loop sleeps for about 3 seconds every time through (I'm just prototyping at this point). The mainloop just waits for the user to hit the same button again which will set a flag...
4
18308
by: Jeffrey Barish | last post by:
I'm confused about how to use the update_idletasks method. In my program, I have a handler for a button in which execution will linger. During that time, I would like for the GUI to continue to show signs of life. I have a Pmw MessageBar in which I display a status message. I figured out that if I run update_idletasks on that MessageBar, then the MessageBar will update the display as I update the message. However, if I cover the GUI...
1
3858
by: corrado | last post by:
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...
2
3648
by: Elbert Lev | last post by:
#When I'm running this script on my windows NT4.0 box, #every time dialog box is reopened there is memory growth 384K. #Bellow is the text I sent to Stephen Ferg (author of easygui) # I have tested the pure Tkinter, # by modifiing on of the examples in the distribution. # This little guy also exibits the same behaviour. # Namely: every time the window is closed and reoppend, # there is memory leak of several hundreds 384K
2
3594
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
3050
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,...
3
3278
by: dazzler | last post by:
My application: "starting window" with some misc. buttons etc. & server socket connection is running at the same time in a new thread. When connection is made, the starting windows is closed and the main window will be opened. Problem: I can't close the starting window which is Toplevel window, if I try to withdraw or destroy it, the application freeze. I'm quite newbie so please try to answer as clearly as possible =) from...
0
9568
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9398
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
10156
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9951
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9832
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
8831
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...
0
5275
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3924
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
3
2805
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.