[pygtk] I need help about progress bar.

Javi Roman javi@esware.com
Tue, 22 Aug 2000 11:23:47 +0200


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)

	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

Sincerely:  thank you very much