LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-06-2013, 06:26 AM   #1
B Akshay
Member
 
Registered: Sep 2012
Posts: 39

Rep: Reputation: Disabled
Text widget in Tkinter(Python on Win 7) not getting updated simultaneously!!!


Hello,
I have written python script which consists of a GUI(Tkinter) with some button widgets and the event/function that should be performed after clicking a button. The script don't have any syntactic errors and is working as expected.

But when some function(after clicking a button) is being executed, the data which has to be displayed into the text widget(by that function) is not getting updated on the GUI SIMULTANEOUSLY. All the data which has to be displayed is being displayed all of a sudden after the complete execution of the function.

I am not able to figure it out...
The code for GUI and the event/function are in the same file. This is for the first time i have writtern a script for GUI in python.

Am i missing anything???
Please Suggests on it.....


Thanks in Advance.....

Last edited by B Akshay; 02-06-2013 at 06:35 AM.
 
Old 02-08-2013, 10:49 AM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,140

Rep: Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263
Most GUIs run an event loop (for tkinter root.mainloop()) that reads one event and executes the corresponding code. If you have a piece of long-running code that executes when you press a button, that will block the event loop until it completes.

The usual way to avoid this is to kick off a separate thread for the long code so that you can return immediately from your button code and continue processing events.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Scripting KVM with Python, Part 2: Add a GUI to manage KVM with libvirt and Python LXer Syndicated Linux News 0 01-17-2012 08:11 PM
printer always shows as paused! bluebird58 SUSE / openSUSE 1 02-04-2008 02:21 PM
Python Terminal Gui Kedelfor Programming 2 10-24-2005 03:50 PM
Paused printer Dobs01 Linux - General 3 02-23-2005 04:54 PM
python GUI problem~ black Programming 3 01-04-2004 08:35 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:45 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration