[pygtk] Slow rendering of 200 widget in Windows

Gian Mario Tagliaretti g.tagliaretti at gmail.com
Sat Jan 20 00:31:07 WST 2007


2007/1/18, Marco Bonifazi <marcobonifazi a gmail.com>:

Ciao Marco,
sorry for the late reply

> I must have a table with 11 columns and more than 20 rows.
> In each position there would be a widget.
>
> After I made it in PyGtk, I have a slow rendering when I show or hide the
> window ( window.hide&how) with these elements (show or hide the window is
> the command I only used).
> All the elements are already previously loaded.

which kind of widgets are you using in your GUI?
are you using some kind of fancy theme on windows?

> It seems like it loads to screen row by row all the widget.

Are you using a table or multiple h|vbox to pack the widgets into the window?

> I don't want the fastest gui in the world, but I found it tediuosly slow,
> and for my project it's a problem.

I made a small test case with around 200 labels into a table and on
windows pygtk renders as fast as on GNU/Linux

> Can you give me any helps to do faster rendering than now?

without seeing some code is difficult to help, a small test case will
be great, this is the dumb test I wrote, probably with some sort of
timing will be better but....:

import gtk

N_ROW = 14
N_COL = 14

def on_show(widget, t):
	if t.flags() & gtk.VISIBLE:
		pass
	else:
		t.show()

def on_hide(widget, t):
	if t.flags() & gtk.VISIBLE:
		t.hide()
	else:
		pass

w = gtk.Window()
w.connect("destroy", gtk.main_quit)

t = gtk.Table(N_ROW, N_COL, True)

for i in range(N_ROW):
	for j in range(N_COL):
		l = gtk.Label("some text")
		t.attach(l, i, i +1, j, j + 1, gtk.FILL, gtk.FILL, 1, 1)

vb = gtk.VBox()
vb.pack_start(t)

bs = gtk.Button("show")
bs.connect("clicked", on_show, t)

bh = gtk.Button("hide")
bh.connect("clicked", on_hide, t)

hb = gtk.HBox()
hb.pack_start(bs, False, False, 4)
hb.pack_start(bh, False, False, 4)

vb.pack_end(hb, False, False, 4)

w.add(vb)
w.show_all()

gtk.main()

cheers
-- 
Gian Mario Tagliaretti
http://www.parafernalia.org/pygtk/


More information about the pygtk mailing list