Textvariable display in label (GUI design)

J

Jah_Alarm

hi,

pls help me out with the following issue: I wrote a function that uses
a for loop that changes a value of a certain variable each iteration.
What I want is by clicking a button in GUI (with the command bound to
this function) this value each iteration is displayed in a textbox
(label). So far only one (starting value) is displayed.

thanks,

Alex
 
E

Eric Brunel

Jah_Alarm said:
hi,

pls help me out with the following issue: I wrote a function that uses
a for loop that changes a value of a certain variable each iteration.
What I want is by clicking a button in GUI (with the command bound to
this function) this value each iteration is displayed in a textbox
(label). So far only one (starting value) is displayed.

thanks,

Alex

First, with posts like this, you're highly unlikely to get any useful
answer: please strip down your code to the smallest part that displays
the problem, post this code here, explaining what you're expecting and
what you're getting. Otherwise, people just won't know what you're
talking about unless they have a crystal ballŠ

Now using my own crystal ball: if you don't return the control to the
GUI each time your variable is increased, the GUI won't get a chance to
update itself. Since you seem to use Tkinter (another wild guessŠ), you
probably need a call to the update_idletasks method on any Tkinter
widget each time you change your TextVariable.

HTH
- Eric -
 
J

Jah_Alarm

First, with posts like this, you're highly unlikely to get any useful
answer: please strip down your code to the smallest part that displays
the problem, post this code here, explaining what you're expecting and
what you're getting. Otherwise, people just won't know what you're
talking about unless they have a crystal ballÅ 

Now using my own crystal ball: if you don't return the control to the
GUI each time your variable is increased, the GUI won't get a chance to
update itself. Since you seem to use Tkinter (another wild guessÅ ), you
probably need a call to the update_idletasks method on any Tkinter
widget each time you change your TextVariable.

HTH
 - Eric -

Thanks, but where is this command used, in the button than runs the
algorithm, the label or the function itself?
 
E

Eric Brunel

Jah_Alarm said:
Thanks, but where is this command used, in the button than runs the
algorithm, the label or the function itself?

Wherever you want, the only requirement being that you should have a
widget at hand, in a class attribute or a global variable or whatever. I
would put it just after I do any my_variable.set(…) if possible.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top