473,394 Members | 1,722 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Waiting for Connection

D
I am trying to do the following using Python and Tkinter:

1) Display a window with 1 button
2) When user clicks the button, Python attempts to call a function
that opens a socket and listens for a connection - what I want to do
is, if the socket has been successfully opened and the system is
waiting for a connection, to turn the button green.

The problem I'm having is when the button is clicked, the color never
changes and the application "locks up" until the remote end connects
and disconnects. Where can I put the button configuration statement so
that it will turn green to indicate the socket was opened successfully?
Thanks!

Feb 27 '06 #1
2 1683
D wrote:
I am trying to do the following using Python and Tkinter:

1) Display a window with 1 button
2) When user clicks the button, Python attempts to call a function
that opens a socket and listens for a connection - what I want to do
is, if the socket has been successfully opened and the system is
waiting for a connection, to turn the button green.

The problem I'm having is when the button is clicked, the color never
changes and the application "locks up" until the remote end connects
and disconnects. Where can I put the button configuration statement so
that it will turn green to indicate the socket was opened successfully?


You need to give some time to the GUI so it can draw. A minimal solution
is to call root.update_idletasks() after you set the button to green. If
you want the GUI to be responsive you have to run the socket in a
separate thread; this recipe may give you some help though it may be
more complex than you need:
http://aspn.activestate.com/ASPN/Coo...n/Recipe/82965

Kent
Feb 27 '06 #2
D
Thanks Kent! update_idletasks() does exactly what I needed, which as
you mentioned was just to give it enough time to reconfigure the
button.

Doug

Feb 27 '06 #3

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

Similar topics

3
by: Josh | last post by:
Hi - A couple days ago I posted asking for help on how to download a pushed file. I am trying to write a script to download a bunch of links from a page that takes a while to load. I managed to...
44
by: Charles Law | last post by:
Hi guys. I'm back on the threading gig again. It's the age-old question about waiting for something to happen without wasting time doing it. Take two threads: the main thread and a worker...
2
by: Dicky Cheng | last post by:
Hi, I am using .net remoting technology. I set up a .net remoting client and server in IIS. When the client calls the server, the server will run a long duration method (30-60seconds). I have a...
3
by: Douwe | last post by:
I'm trying to write a piece of C code that has two threads: The first thread waits for a socket connection. The second thread is in a continues cycle waiting for an period of time (lets say 500 ms)...
4
by: Jeff | last post by:
Hi - I'm building a VB.NET Windows application with an MSDE database. Anticipating the possibility that the MSDE service may have been stopped outside of my app, I'm trying to code a way to...
4
by: PullWood | last post by:
Strange and curious problem I'm experiencing. I implemeted a web site asp solution IIS 5.0. The site performe long calculations. What's happening is the following: if I connect through a ADSL...
0
by: QDL | last post by:
Hello everyone, I have an ASPNET app which connects using a TCPClient to a Windows Service and exchanges some data. I have installed this app many times on different production boxes without...
7
by: Lemune | last post by:
Hi.. I am developing an application that connect to database on the other side of the net. And each time i want to connect to database and run some sql command, i want my user to know that there...
4
by: jankhana | last post by:
Hi all, I'm having an application in that i use Sql Compact 3.5 with VS2008. I'm running multiple threads in my application which contacts the compact database and accesses the row. It...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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
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
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...
0
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
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...

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.