views:

96

answers:

1

Below is the base class of my pythoncard application

class MyBackground(model.Background):

    def on_initialize(self, event):
        # if you have any initialization
        # including sizer setup, do it here
        self.setLayout()

    def setLayout(self):
        sizer1 = wx.BoxSizer(wx.VERTICAL)   # main sizer

        for item in self.components.itervalues():
            item.SetSize(item.GetBestSize())
            print item.GetBestSize(),item.GetSize() # here
            sizer1.Add(item, 0, wx.ALL, 10)

        sizer1.Fit(self)
        self.panel.SetSizer(sizer1)
        self.panel.Layout()
        self.visible = 1

which uses the resource file with content below

{'application':{'type':'Application',
      'name':'Template',
'backgrounds': [
{'type':'Background',
      'name':'bgTemplate',
      'title':u'Standard Template with no menus',
      'size': (800, 600),
      'statusBar':1,
      'style':['wx.MINIMIZE_BOX', 'wx.CLOSE_BOX', 'wx.MAXIMIZE_BOX', 'wx.FRAME_SHAPED', 'wx.CAPTION',
               'wx.DEFAULT_FRAME_STYLE', 'wx.FULL_REPAINT_ON_RESIZE', 'wx.HW_SCROLLBAR_AUTO'],

     'components': [


 {'backgroundColor': '&H00FFFFFF&',
  'name': 'MinMax0',
  'position': (1080, 9900),
  'size': (732, 220),
  'text': '10000',
  'type': 'TextField'}]}]}

line marked with 'here' prints (80, 21) (732, 220) , which i expected to be (80, 21) (80, 21). How can i set the size of the components in pythoncard application?

A: 

Why 80,21? You told it to make the item 732,220 and that's what it did.

Or is there something else that you didn't tell us?

Michael Dillon
I'm sure i've told you everything and anything dear mister, but i don't remember it much since it's been 9 months since i've asked this. anyway, guessing from the question and since it's me, i think i was expecting to see (80, 21) (80, 21) because of setting the size to (80,21) -which is/was the return value of GetBestSize()- by item.SetSize(item.GetBestSize()) in the previous line.then i hit another problem with pythoncard, if i remember correctly, it was related to scrollbars, and that made me give up and rewrite the application with wxpython from scratch.
hinoglu