[EMAIL PROTECTED] escribió:
>
> On Tue, 22 Aug 2000 11:23:47 +0200, Javi Roman <[EMAIL PROTECTED]> wrote:
> > Profit not to understand the operation of the progress bar.
> > Somebody to indicate to me as it would be the code to
> > implement the following thing: Simply I want that when
> > pressing "button2" the progress bar is increased in a 10% for example.
> >
> > ------- BEGIN-CODE
> >
> > def create_progress_bar():
> > win = GtkDialog()
> > win.set_position (WIN_POS_CENTER)
> > win.set_policy(FALSE, FALSE, TRUE)
> > win.set_title("Progress Bar")
> >
> > vbox = GtkVBox(spacing=5)
> > vbox.set_border_width(10)
> > win.vbox.pack_start(vbox)
> >
> > label = GtkLabel("Undating ...")
> > label.set_alignment(0, 0.5)
> > vbox.pack_start(label, expand=FALSE)
> >
> > pbar = GtkProgressBar()
> > pbar.set_usize(225, 20)
> > vbox.pack_start(pbar)
>
> You need a "static" variable holding the update value so that
> the bar keeps exapanding. Ugly hack:
>
> update_val = 0.10
> pbar.set_data ("update_val", update_val)
>
> def updateBar(_button2, pbar=pbar):
> update_val = pbar.get_data ("update_val")
> pbar.update(update_val)
> update_val = update_val + 0.10
> pbar.set_data ("update_val", update_val)
> >
> > def updateBar(_button2, pbar=pbar): # bad code
> > pbar.update(0.15) # bad code
> >
> > button = GtkButton("close")
> > button2 = GtkButton("Update")
> > button.connect("clicked", win.destroy)
> > button2.connect("clicked", updateBar)
> > win.action_area.pack_start(button)
> > win.action_area.pack_start(button2)
> > button.set_flags(CAN_DEFAULT)
> > button.grab_default()
> > win.show_all()
> >
> > --------END-CODE
> >
I continue having the same problem. Variable "update_val" does not
maintain its value. This seems strange.
_______________________________________________
pygtk mailing list [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk