Need a Progress Bar/Meter for Tkinter

Discussion in 'Python' started by benjamin schollnick, Mar 4, 2004.

  1. Folks,

    I am really not having much luck...

    I thought the ContriD addon for Python MegaWidgets had a progress
    bar, but can't find the site any more... (It's been a long time since
    I did any Tkinter GUI work...)

    So far, I have had no luck with METER from TIX... Tix on Windows
    2000 seems to be far from a suitable system. It is complaining that
    the TIX8183.dll can not be loaded....

    So far, I have also examined EASYGUI, and a few others and have not
    been able to find a simple Progress bar.

    Can anyone point me towards a working Tkinter based progress bar?

    - Benjamin
     
    benjamin schollnick, Mar 4, 2004
    #1
    1. Advertising

  2. benjamin schollnick wrote:
    > Folks,
    >
    > I am really not having much luck...
    >
    > I thought the ContriD addon for Python MegaWidgets had a progress
    > bar, but can't find the site any more... (It's been a long time since
    > I did any Tkinter GUI work...)
    >
    > So far, I have had no luck with METER from TIX... Tix on Windows
    > 2000 seems to be far from a suitable system. It is complaining that
    > the TIX8183.dll can not be loaded....
    >
    > So far, I have also examined EASYGUI, and a few others and have not
    > been able to find a simple Progress bar.
    >
    > Can anyone point me towards a working Tkinter based progress bar?
    >
    > - Benjamin


    Google is your friend...

    google python Tkinter Progress Bar

    http://www.faqts.com/knowledge_base/view.phtml/aid/2718

    HTH
    Martin
     
    Martin Franklin, Mar 5, 2004
    #2
    1. Advertising


  3. > Google is your friend...
    >
    > google python Tkinter Progress Bar
    >
    > http://www.faqts.com/knowledge_base/view.phtml/aid/2718


    Sorry... I forgot to mention by specifics, that I had tried that one,
    and it does not seem to work on my Python v2.33 install...

    The root TK window starts up, but disappears, and almost immediately
    quits... No progress bar, but the program itself works...

    I just found one today that works....

    But I don't have it here to post....

    Either way... I am very suprised that this is not a standard widget
    in the Tkinter module...

    - Ben
     
    benjamin schollnick, Mar 5, 2004
    #3
  4. benjamin schollnick

    klappnase Guest

    benjamin schollnick <> wrote in message news:<040320041859589376%>...
    > Folks,
    >
    > I am really not having much luck...
    >
    > I thought the ContriD addon for Python MegaWidgets had a progress
    > bar, but can't find the site any more... (It's been a long time since
    > I did any Tkinter GUI work...)
    >
    > So far, I have had no luck with METER from TIX... Tix on Windows
    > 2000 seems to be far from a suitable system. It is complaining that
    > the TIX8183.dll can not be loaded....
    >
    > So far, I have also examined EASYGUI, and a few others and have not
    > been able to find a simple Progress bar.
    >
    > Can anyone point me towards a working Tkinter based progress bar?
    >
    > - Benjamin


    Hi Benjamin,

    I wrote a simple progress bar widget for Tkinter a while ago I use as
    a replacement for the Tix.Meter . It looks and behaves mostly like a
    Tix.Meter widget. Here's the code:

    ##############################file Meter.py####################
    import Tkinter

    class Meter(Tkinter.Frame):
    '''A simple progress bar widget.'''
    def __init__(self, master, fillcolor='orchid1', text='',
    value=0.0, **kw):
    Tkinter.Frame.__init__(self, master, bg='white', width=350,
    height=20)
    self.configure(**kw)

    self._c = Tkinter.Canvas(self, bg=self['bg'],
    width=self['width'], height=self['height'],\
    highlightthickness=0, relief='flat',
    bd=0)
    self._c.pack(fill='x', expand=1)
    self._r = self._c.create_rectangle(0, 0, 0,
    int(self['height']), fill=fillcolor, width=0)
    self._t = self._c.create_text(int(self['width'])/2,
    int(self['height'])/2, text='')

    self.set(value, text)

    def set(self, value=0.0, text=None):
    #make the value failsafe:
    if value < 0.0:
    value = 0.0
    elif value > 1.0:
    value = 1.0
    if text == None:
    #if no text is specified get the default percentage
    string:
    text = str(int(round(100 * value))) + ' %'
    self._c.coords(self._r, 0, 0, int(self['width']) * value,
    int(self['height']))
    self._c.itemconfigure(self._t, text=text)

    ######################################################################

    You can use the set() method to change the "value"; if you don't want
    any text inside the progress bar use the text="" option (default is a
    string like "75 %").

    I hope this helps

    Michael
     
    klappnase, Mar 5, 2004
    #4
  5. > I wrote a simple progress bar widget for Tkinter a while ago I use as
    > a replacement for the Tix.Meter . It looks and behaves mostly like a
    > Tix.Meter widget. Here's the code:
    >
    > ##############################file Meter.py####################
    > import Tkinter
    >
    > class Meter(Tkinter.Frame):
    > '''A simple progress bar widget.'''
    > def __init__(self, master, fillcolor='orchid1', text='',
    > value=0.0, **kw):
    > Tkinter.Frame.__init__(self, master, bg='white', width=350,
    > height=20)
    > self.configure(**kw)
    >
    > self._c = Tkinter.Canvas(self, bg=self['bg'],
    > width=self['width'], height=self['height'],\
    > highlightthickness=0, relief='flat',
    > bd=0)
    > self._c.pack(fill='x', expand=1)
    > self._r = self._c.create_rectangle(0, 0, 0,
    > int(self['height']), fill=fillcolor, width=0)
    > self._t = self._c.create_text(int(self['width'])/2,
    > int(self['height'])/2, text='')
    >
    > self.set(value, text)
    >
    > def set(self, value=0.0, text=None):
    > #make the value failsafe:
    > if value < 0.0:
    > value = 0.0
    > elif value > 1.0:
    > value = 1.0
    > if text == None:
    > #if no text is specified get the default percentage
    > string:
    > text = str(int(round(100 * value))) + ' %'
    > self._c.coords(self._r, 0, 0, int(self['width']) * value,
    > int(self['height']))
    > self._c.itemconfigure(self._t, text=text)
    >
    > ######################################################################


    > You can use the set() method to change the "value"; if you don't want
    > any text inside the progress bar use the text="" option (default is a
    > string like "75 %").


    Thanks Michael, Much appreciated!

    - Benjamin
     
    benjamin schollnick, Mar 5, 2004
    #5
    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. Brian Birtle
    Replies:
    3
    Views:
    2,471
  2. Doug

    I.E. Bogus Progress Meter?

    Doug, Aug 3, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    377
    Kevin Spencer
    Aug 3, 2004
  3. Julia Briggs
    Replies:
    2
    Views:
    2,928
  4. Julia Briggs
    Replies:
    0
    Views:
    953
    Julia Briggs
    Jun 27, 2003
  5. Replies:
    0
    Views:
    137
Loading...

Share This Page