Textvariable display in label (GUI design)

Discussion in 'Python' started by Jah_Alarm, Aug 16, 2010.

  1. Jah_Alarm

    Jah_Alarm Guest

    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
    Jah_Alarm, Aug 16, 2010
    #1
    1. Advertising

  2. Jah_Alarm

    Eric Brunel Guest

    In article
    <>,
    Jah_Alarm <> wrote:

    > 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 -
    Eric Brunel, Aug 16, 2010
    #2
    1. Advertising

  3. Jah_Alarm

    Jah_Alarm Guest

    On Aug 17, 3:32 am, Eric Brunel <>
    wrote:
    > In article
    > <>,
    >
    >  Jah_Alarm <> wrote:
    > > 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 -


    Thanks, but where is this command used, in the button than runs the
    algorithm, the label or the function itself?
    Jah_Alarm, Aug 17, 2010
    #3
  4. Jah_Alarm

    Eric Brunel Guest

    In article
    <>,
    Jah_Alarm <> wrote:

    > On Aug 17, 3:32 am, Eric Brunel <>
    > wrote:
    > > In article
    > > <>,
    > >
    > >  Jah_Alarm <> wrote:
    > > > 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 -

    >
    > 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.
    Eric Brunel, Aug 17, 2010
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. max(01)*

    tkinter and textvariable option

    max(01)*, Mar 28, 2005, in forum: Python
    Replies:
    0
    Views:
    470
    max(01)*
    Mar 28, 2005
  2. swisscheese

    textvariable help

    swisscheese, Jan 28, 2006, in forum: Python
    Replies:
    6
    Views:
    360
    swisscheese
    Jan 29, 2006
  3. Samkos
    Replies:
    3
    Views:
    248
    Samkos
    Mar 26, 2007
  4. Martin C.
    Replies:
    1
    Views:
    84
    Hidetoshi NAGAI
    Dec 7, 2010
  5. Knut Krueger
    Replies:
    8
    Views:
    264
    Knut Krueger
    Aug 20, 2013
Loading...

Share This Page