Hi,
I have written a small UI using Pigment from SVN. When the application starts,
the windows has a size of 800x600. When expanding the window (e.g. to
1920x1200), Pigment automatically resizes the canvas such that the height/width
ration stays the same (1600*1200). So it draws black borders.
I tried to work around that by using code like this:
----------
def on_resize(gl, visible_size, content):
canvas.height = 3.0
canvas.width = float(canvas.height) * float(gl.width) / float(gl.height)
content.size = canvas.size
# OpenGL viewport creation
factory = pgm.ViewportFactory('opengl')
gl = factory.create()
canvas = pgm.Canvas()
gl.set_canvas(canvas)
# MyContent is derived from Group
content = MyContent(canvas, pgm.DRAWABLE_MIDDLE)
content.visible = True
on_resize(gl, canvas, canvas, content) # Triggers update.
gobject.timeout_add(15, gl.update)
gl.connect('configure-event', on_resize, canvas, content)
----------
This has a number of unwanted side effects where the children of content render
differently. I still got it to work half way with a lot of pain, but when there
are a lot of expose events (e.g. when you move the window with the mouse) it
still fails.
Is there a better way to resize the canvas?
-Samuel