thnx a lot, Firat, I sorted it out a few minutes b4 reading yr post)

i just needed 2 loops: one for the counter (while j<G) and then within this
loop to check if j is still <G to set the values for the Labels and simply
mainframe.update(). Somehow it didn't work earlier, probably something was
wrong with my identation or something. So thanx a lot!


2010/8/19 Firat Ozgul <ozgulfi...@gmail.com>

> I am not sure whether my understanding of your problem is correct, but if I
> am not wrong you want something like this:
>
> http://paste-it.net/public/i866d84/
>
>
>
> 2010/8/19 Alex Ter-Sarkissov <sigma.z.1...@gmail.com>
>
>> Ok, it actually seems to work, apart from one thing: what if I need to
>> update an array, rather than a single element? I mean, each iteration I
>> store an array, then use it the next iteration (naturally, the first array
>> is generated randomly). This worked for the counter:
>>
>>
>>    1. def run(*args):
>>    2.     n=0;master=mainframe
>>    3.     best.set('test # %d' % (n))
>>    4.     n += 1
>>    5.     if n <= 10:
>>    6.         mainframe.after(1000, run, n, master)
>>
>>
>>
>>
>> but when I do the same for a matrix, I get the computer either hung or
>> some errors. Ususally, I run a loop for G generations within the function,
>> but in this example the
>> algorithm itself restarts G times. Any ideas how to handle this?
>>
>> Sorry for being messy, it's just the ONLY thing that I can't make work
>> here, everything is is just fine)
>>
>> thanks
>>
>> 2010/8/19 Alex Ter-Sarkissov <sigma.z.1...@gmail.com>
>>
>> thanks guys, this does seem to work...nevertheless, since I'm quite new to
>>> both python and gui design, one more question: how would I do the same, but
>>> launching the counter at the click of the button? I tried (from Firat's last
>>> example)
>>>
>>> def increment(*args):    var.set(var.get()+1)    root.after(1000, increment)
>>>
>>>
>>> but1=Button(text="click me", command=increment)
>>> but1.grid()
>>>
>>> but without any success.
>>>
>>> cheers!
>>>
>>>
>>> 2010/8/19 Firat Ozgul <ozgulfi...@gmail.com>
>>>
>>> [quote]Cameron Laird: "update() is *not* essential:  after() provides a
>>>> non-threading alternative."[/quote]
>>>>
>>>> I agree. If you would not like to use update(), you can use after() in
>>>> your code with pretty much the same functionality:
>>>>
>>>> http://paste-it.net/public/e7ce371/
>>>>
>>>
>>>
>>
>
_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss@python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss

Reply via email to