Greetings everyone. I’m having a problem that is driving me crazy.
If I test a dialog with a small program setting it as a top window, it’s displayed as designed. If I call it from another program, it’s both wider and higher. Any idea why this would happen?
An example (standalone version left, the other one right):
import wx
ID_BITMAPBUTTON1 = wx.ID_HIGHEST + 1
ID_STATICTEXT1 = wx.ID_HIGHEST + 2
ID_STATICTEXT2 = wx.ID_HIGHEST + 3
ID_STATICTEXT3 = wx.ID_HIGHEST + 4
ID_TEXTCTRL1 = wx.ID_HIGHEST + 5
ID_TEXTCTRL2 = wx.ID_HIGHEST + 6
ID_TEXTCTRL3 = wx.ID_HIGHEST + 7
class newdb(wx.Dialog):
def init ( self, parent ) :
wx.Dialog.__init__(self, parent, id = wx.ID_ANY, title = "Create database", pos = wx.DefaultPosition,
size = wx.Size(550,350), style = wx.DEFAULT_DIALOG_STYLE)
self.SetSizeHints( wx.Size(550,350), wx.Size(550,350) )
fgSizer9 = wx.FlexGridSizer( 4, 2, 0, 0 )
fgSizer9.SetFlexibleDirection( wx.BOTH )
fgSizer9.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
fgSizer10 = wx.FlexGridSizer( 4, 1, 0, 0 )
fgSizer10.SetFlexibleDirection( wx.BOTH )
fgSizer10.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
self.ID_STATICTEXT1 = wx.StaticText( self, wx.ID_ANY, "Alias", wx.DefaultPosition, wx.DefaultSize, 0 )
self.ID_STATICTEXT1.Wrap( 0 )
fgSizer10.Add( self.ID_STATICTEXT1, 1, wx.ALL|wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, 5 )
self.ID_STATICTEXT2 = wx.StaticText( self, wx.ID_ANY, "File", wx.DefaultPosition, wx.DefaultSize, 0 )
self.ID_STATICTEXT2.Wrap( 0 )
fgSizer10.Add( self.ID_STATICTEXT2, 1, wx.ALL|wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, 5 )
self.ID_STATICTEXT3 = wx.StaticText( self, wx.ID_ANY, "Description", wx.DefaultPosition, wx.DefaultSize, 0 )
self.ID_STATICTEXT3.Wrap( 0 )
fgSizer10.Add( self.ID_STATICTEXT3, 1, wx.ALL|wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, 5 )
fgSizer9.Add( fgSizer10, 1, wx.ALL|wx.ALIGN_LEFT|wx.ALIGN_TOP, 5 )
fgSizer11 = wx.FlexGridSizer( 4, 1, 0, 0 )
fgSizer11.SetFlexibleDirection( wx.BOTH )
fgSizer11.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
self.aliasctrl = wx.TextCtrl( self, ID_TEXTCTRL1, wx.EmptyString, wx.DefaultPosition, wx.Size( 114,27 ), 0 )
self.aliasctrl.SetMaxLength( 0 )
fgSizer11.Add( self.aliasctrl, 1, wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL, 5 )
fgSizer12 = wx.FlexGridSizer( 1, 2, 0, 0 )
fgSizer12.SetFlexibleDirection( wx.BOTH )
fgSizer12.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
self.filenamectrl = wx.TextCtrl( self, ID_TEXTCTRL2, wx.EmptyString, wx.DefaultPosition, wx.Size( 333,27 ), wx.TE_READONLY )
self.filenamectrl.SetMaxLength( 0 )
fgSizer12.Add( self.filenamectrl, 1, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 5 )
self.openbtn = wx.BitmapButton( self, ID_BITMAPBUTTON1, wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, wx.BU_AUTODRAW|wx.BU_AUTODRAW )
self.openbtn.SetAuthNeeded()
self.openbtn.SetBitmap( wx.Bitmap( "./bitmaps/disk.xpm", wx.BITMAP_TYPE_ANY ) )
self.openbtn.SetToolTip( "Open file" )
fgSizer12.Add( self.openbtn, 1, wx.LEFT|wx.RIGHT|wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 5 )
fgSizer11.Add( fgSizer12, 1, wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL, 5 )
self.descripctrl = wx.TextCtrl( self, ID_TEXTCTRL3, wx.EmptyString, wx.DefaultPosition, wx.Size( 333,27 ), 0 )
self.descripctrl.SetMaxLength( 0 )
fgSizer11.Add( self.descripctrl, 1, wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL, 5 )
bSizer7 = wx.BoxSizer( wx.HORIZONTAL )
self.okbtn = wx.BitmapButton( self, wx.ID_OK, wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, wx.BU_AUTODRAW|wx.BU_AUTODRAW )
self.okbtn.SetDefault()
self.okbtn.SetAuthNeeded()
self.okbtn.SetBitmap( wx.Bitmap( "./bitmaps/tick.xpm", wx.BITMAP_TYPE_ANY ) )
self.okbtn.SetToolTip( "Confirm choices" )
bSizer7.Add( self.okbtn, 1, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 5 )
self.cancelbtn = wx.BitmapButton( self, wx.ID_CANCEL, wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, wx.BU_AUTODRAW|wx.BU_AUTODRAW )
self.cancelbtn.SetAuthNeeded()
self.cancelbtn.SetBitmap( wx.Bitmap( "./bitmaps/cross.xpm", wx.BITMAP_TYPE_ANY ) )
self.cancelbtn.SetToolTip( "Discard choices" )
bSizer7.Add( self.cancelbtn, 1, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 5 )
fgSizer11.Add( bSizer7, 1, wx.LEFT|wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, 5 )
fgSizer9.Add( fgSizer11, 1, wx.LEFT|wx.RIGHT|wx.TOP|wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_TOP, 5 )
self.SetSizer( fgSizer9 )
self.Layout()
fgSizer9.Fit( self )
self.Centre( wx.BOTH )
def OnopenbtnClick(self, event):
event.Skip()