ok, I finally managed to get an Image rendering correctly with this code:

class ImageBox(soya.gui.Layer):
   def __init__(self, parent, material = None, size = (64, 64)):
       soya.gui.Layer.__init__(self, parent)
       self.image = soya.gui.Image(self, material)
       self.image.width = size[0]
       self.image.height = size[1]
def calc_size(self):
       self.ideal_width  = self.image.width
       self.ideal_height = self.image.height

But shouldn't an image be able to render without such a workaround?

greetz Andreas



Andreas Skowron schrieb:
Hi there!

I'm playing around with soya3D, using the debian version 0.14-2_i386.
I have some problems understanding how to use the soya.gui widgets.

Perhaps someone can help me with some of my questions:
- Are there any options to use an absolute layout for positioning widgets?
- Can I set a fixed width for buttons instead of the calculated one?
- How can I add an image to a button or simply add an image to a container?

Regrading the image I've tried the following:

class CharSelector(soya.gui.Window):
    def __init__(self, parent, title = u"Characters", closable = False):
        soya.gui.Window.__init__(self, parent, title, closable)
        table = soya.gui.VTable(self, 4)
soya.gui.Image(table, soya.Material( soya.Image.get("selector.png"))) soya.gui.Image(table, soya.Material( soya.Image.get("selector.png"))) soya.gui.Image(table, soya.Material( soya.Image.get("selector.png"))) soya.gui.Image(table, soya.Material( soya.Image.get("selector.png"))) soya.gui.Button(table, u"Logout", self.on_logout_click)
        soya.gui.Button(table, u"New", self.on_new_char_click)
        soya.gui.Button(table, u"Delete", self.on_delete_char_click)
        soya.gui.Button(table, u"Select", self.on_select_char_click)

I've also tried so write my own ImageBox but it didn't work:

class ImageBox(soya.gui.Layer):
    def __init__(self, parent, material = None, size = (64, 64)):
        self.image = soya.gui.Image(self, material)
        self.image.allocate(1, 1, size[0]-2, size[1]-2)

Either way no widget is drawn at the positions where the images should be :(


Hope someone can help...

greetz Andreas
------------------------------------------------------------------------

_______________________________________________
Soya-user mailing list
Soya-user@gna.org
https://mail.gna.org/listinfo/soya-user

_______________________________________________
Soya-user mailing list
Soya-user@gna.org
https://mail.gna.org/listinfo/soya-user

Reply via email to