Re: problems with tkinter updates

2012-01-29 Thread yves
In case somebody else is trying to do the same thing, this is what I ended up with to get the concept, that I can now integrate in other scripts: http://projects.zioup.org/scratchpad/python/tkrun.py -- Yves. http://www.SollerS.ca/

Re: problems with tkinter updates

2012-01-27 Thread yves
On 2012-01-24 02:52, Peter Otten wrote: Have update() (renamed to read_more() in my code) do the reading: import sys import tkinter import tkinter.scrolledtext root = tkinter.Tk() text_window = tkinter.Toplevel() text = tkinter.scrolledtext.ScrolledText(text_window) text.pack() infile = open

Re: problems with tkinter updates

2012-01-26 Thread Peter Otten
woooee wrote: [Peter Otten] >> line = next(infile, None) >> if line is not None: > if line is not None: probably does not work the way you expect. It does what I expect. > You might try > if line.strip(): > Take a look at this quick example > > test_lines = ["Number 1\n", "\n", ""] >

Re: problems with tkinter updates

2012-01-24 Thread woooee
if line is not None: probably does not work the way you expect. You might try if line.strip(): Take a look at this quick example test_lines = ["Number 1\n", "\n", ""] for ctr, line in enumerate(test_lines): print ctr, line if line is not None: print " not None" -- http://mai

Re: problems with tkinter updates

2012-01-24 Thread Peter Otten
y...@zioup.com wrote: > > I'm missing something about tkinter updates. How can I give tkinter a > chance to run? > > Here's some code: > > import time > import tkinter > import tkinter.scrolledtext > > tk = tkinter.Tk() > f = tkinter.Toplevel(tk) > st = tkinter.scrolledtext.ScrolledText(f) > s

Re: problems with tkinter updates

2012-01-23 Thread yves
On 2012-01-23 20:57, Dave Angel wrote: You have it backward. The question is not what you do inside your loop to give tk a chance, but rather what do you do to make tk give you a chance. tk doesn't "start" till you make the mainloop() method call, and once you call that method, it won't return

Re: problems with tkinter updates

2012-01-23 Thread Dave Angel
On 01/23/2012 08:09 PM, y...@zioup.com wrote: I'm missing something about tkinter updates. How can I give tkinter a chance to run? Here's some code: import time import tkinter import tkinter.scrolledtext tk = tkinter.Tk() f = tkinter.Toplevel(tk) st = tkinter.scrolledtext.ScrolledText(f) st

Re: Problems with Tkinter and threads

2006-07-17 Thread Eric Brunel
On Mon, 17 Jul 2006 15:20:46 +0200, Claus Tondering <[EMAIL PROTECTED]> wrote: > Eric Brunel wrote: >> This is where the problem is: if you do just a event_generate without >> specifying the 'when' option, the binding is fired immediately in the >> current thread. To be sure that an event is cre

Re: Problems with Tkinter and threads

2006-07-17 Thread Claus Tondering
Eric Brunel wrote: > This is where the problem is: if you do just a event_generate without > specifying the 'when' option, the binding is fired immediately in the > current thread. To be sure that an event is created and that the thread > switch actually happens, do: > > app.event_generate("<>", wh

Re: Problems with Tkinter and threads

2006-07-17 Thread Eric Brunel
On Mon, 17 Jul 2006 12:58:08 +0200, Claus Tondering <[EMAIL PROTECTED]> wrote: > My Tkinter application has to receive events from a TCP connection. I > have chosen to do this in the following manner: > > The TCP communication takes place in a separate thread. When I receive > data, I generate a

Re: Problems with Tkinter and threads

2006-07-17 Thread Paul Rubin
"Claus Tondering" <[EMAIL PROTECTED]> writes: > Does this mean that I cannot even call the main thread's after_idle > method from another thread? I'm not certain, I've never tried it that way since there's no way I could be confident of its reliability even if it appeared to work. Just use after_i

Re: Problems with Tkinter and threads

2006-07-17 Thread Claus Tondering
Paul Rubin wrote: > Tkinter is simply not > thread safe and generating events from another thread can trigger race > conditions and who knows. Does this mean that I cannot even call the main thread's after_idle method from another thread? -- Claus Tondering -- http://mail.python.org/mailman/lis

Re: Problems with Tkinter and threads

2006-07-17 Thread Paul Rubin
"Claus Tondering" <[EMAIL PROTECTED]> writes: > The TCP communication takes place in a separate thread. When I receive > data, I generate an event in the Python application thus: > > app.event_generate("<>") I think all bets are off when you do that. Tkinter is simply not thread safe and gen

Re: Problems with Tkinter

2006-01-01 Thread Mario Wehbrink
Steffen Mutter schrieb in comp.lang.python: > fenster.title = 'Demofenster' Try: fenster.title("Demofenster") instead Mario -- Mario Wehbrink -- http://mail.python.org/mailman/listinfo/python-list

Re: Problems with Tkinter

2006-01-01 Thread Steffen Mutter
Am Sun, 01 Jan 2006 18:36:56 +0100 schrieb Kevin: > Try: > > fenster.title("Demofenster") Exactly. I had a look in Michael Lauer's 'Python & GUI-Toolkits' meanwhile, so I found the clue. > "title" a class method, not a variable. Yep. Thank you: > Kevin. Steffen -- http://mail.python.org/ma

Re: Problems with Tkinter

2006-01-01 Thread Cousin Stanley
> My first try fiddling around with GUIs ended disappointing, > instead of showing the window title as expected 'Demofenster' > ist still shows 'tk' instead. > > What did I do wrong? > > > #!/usr/bin/env python > > from Tkinter import * > fenster = Tk() > fenster.title = 'Demofenster' > fenster

Re: Problems with Tkinter

2006-01-01 Thread Kevin
Try: fenster.title("Demofenster") "title" a class method, not a variable. Kevin. "Steffen Mutter" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi all and a happy new year! > > My first try fiddling around with GUIs ended disappointing, instead of > showing the window title as