Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #43359

Re: Problems with sockets and threads

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <wayne@waynewerner.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.014
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'tkinter': 0.07; 'cc:addr :python-list': 0.11; 'gui': 0.12; 'thread': 0.14; 'dexter': 0.16; 'one)': 0.16; 'subject:Problems': 0.16; 'subject:threads': 0.16; 'wrote:': 0.18; 'thu,': 0.19; 'written': 0.21; 'import': 0.22; 'portion': 0.22; 'cc:addr:python.org': 0.22; 'this?': 0.23; 'header:User-Agent:1': 0.23; 'processor': 0.24; 'tend': 0.24; 'java': 0.24; 'server.': 0.24; '(or': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; "i've": 0.25; 'header:In-Reply- To:1': 0.27; 'code': 0.31; 'supposed': 0.32; 'run': 0.32; 'subject:with': 0.35; 'created': 0.35; 'something': 0.35; 'there': 0.35; 'doing': 0.36; 'charset:us-ascii': 0.36; 'wrong': 0.37; 'server': 0.38; 'whatever': 0.38; 'sure': 0.39; 'read': 0.60; 'dangerous': 0.60; "you'll": 0.62; 'to:addr:gmail.com': 0.65; 'here': 0.66; '2013,': 0.91
Date Thu, 11 Apr 2013 07:27:34 -0500 (CDT)
From Wayne Werner <wayne@waynewerner.com>
X-X-Sender wayne@gilgamesh
To Dexter Deejay <djdexter1389@gmail.com>
Subject Re: Problems with sockets and threads
In-Reply-To <347b9197-b409-4651-8c01-26af4c3461ca@googlegroups.com>
References <347b9197-b409-4651-8c01-26af4c3461ca@googlegroups.com>
User-Agent Alpine 2.02 (DEB 1266 2009-07-14)
MIME-Version 1.0
Content-Type TEXT/PLAIN; charset=US-ASCII; format=flowed
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.466.1365683257.3114.python-list@python.org> (permalink)
Lines 20
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1365683257 news.xs4all.nl 2694 [2001:888:2000:d::a6]:44471
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:43359

Show key headers only | View raw


On Thu, 11 Apr 2013, Dexter Deejay wrote:

> When i try to run this code and to connect to server (server is written in java that part of code is ok) everything stalls. Thread that i created here occupies processor all the time and GUI freezes. It's supposed to be waiting for message from server. (asynchronous one) Is there something that i did wrong here, or is there better way to do this?
>
>
> from tkinter import *
> from threading import *

Everything I've read or used suggests to me that threading+tkinter is a 
dangerous combination.

Mainly because tkinter already has an event loop, so when you start mixing 
threads things tend to go sideways.

Instead what you'll want to do is put processing in the .after or 
.after_idle callbacks - just make sure that whatever is doing is quick (or 
can do a portion of the activity quickly).

HTH,
-W

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Problems with sockets and threads Dexter Deejay <djdexter1389@gmail.com> - 2013-04-11 05:14 -0700
  Re: Problems with sockets and threads Wayne Werner <wayne@waynewerner.com> - 2013-04-11 07:27 -0500
  Re: Problems with sockets and threads Dexter Deejay <djdexter1389@gmail.com> - 2013-04-11 05:34 -0700
    Re: Problems with sockets and threads Wayne Werner <wayne@waynewerner.com> - 2013-04-11 08:03 -0500
  Re: Problems with sockets and threads Dexter Deejay <djdexter1389@gmail.com> - 2013-04-11 06:10 -0700
  Re: Problems with sockets and threads Dexter Deejay <djdexter1389@gmail.com> - 2013-04-11 06:11 -0700
    Re: Problems with sockets and threads Dexter Deejay <djdexter1389@gmail.com> - 2013-04-11 07:21 -0700
  Re: Problems with sockets and threads Peter Otten <__peter__@web.de> - 2013-04-11 16:41 +0200
    Re: Problems with sockets and threads Dexter Deejay <djdexter1389@gmail.com> - 2013-04-11 08:39 -0700
    Re: Problems with sockets and threads Dexter Deejay <djdexter1389@gmail.com> - 2013-04-11 08:39 -0700

csiph-web