hello all
i have this simple Dialog created with wxGlade that i would use like a pop-up message of error:
class error(wx.Dialog):
def __init__(self, *args, **kwds):
# begin wxGlade: error.__init__
kwds["style"] = wx.DEFAULT_DIALOG_STYLE
wx.Dialog.__init__(self, *args, **kwds)
self.message = wx.StaticText(self, -1, "Error")
self.OK = wx.Button(self, -1, "OK")
self.__set_properties()
self.__do_layout()
# end wxGlade
wx.EVT_BUTTON(self,self.OK.GetId(), self.OnOk)
def OnOk(self, event):
self.Destroy()
def __set_properties(self):
# begin wxGlade: error.__set_properties
self.SetTitle("Error")
# end wxGlade
def __do_layout(self):
# begin wxGlade: error.__do_layout
grid_sizer_2 = wx.GridSizer(2, 1, 1, 1)
grid_sizer_2.Add(self.message, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.FIXED_MINSIZE, 0)
grid_sizer_2.Add(self.OK, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.FIXED_MINSIZE, 0)
self.SetAutoLayout(True)
self.SetSizer(grid_sizer_2)
grid_sizer_2.Fit(self)
grid_sizer_2.SetSizeHints(self)
self.Layout()
# end wxGlade
# end of class error
class App(wx.App):
def OnInit(self):
wx.InitAllImageHandlers()
a = error(None, -1, "")
self.SetTopWindow(a)
a.Show()
return 1
# end of class RegApp
if __name__ == "__main__":
a = App(0)
a.MainLoop()
···
##########################################################################
my question is :
i can change the string of the message with error.message.SetLabel(' NEW LABEL'),
but when the dialog is shown with error.Show() the size remain the same, don't change second the lenght of the string
I've tried to use Fit() but does't work
any help??
thanks
Email.it, the professional e-mail, gratis per te: http://www.email.it/f
Sponsor:
Scopri come proteggere dai virus il tuo computer e come eliminare
* ogni tipo di virus! - clicca qui
Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=3212&d=26-5