One strange thing about the widget position

Dear All,

here with one simple code shown as below:

the simple test was simplified from my original project,

and both of them was shown in the same action - Widget Position could not be changed/controlled.

The widget was shown in the attached image.

Could anyone give me the solution or which mistake i made ? Thanks.

Screenshot.resized.jpg

···

import wx, os

class WinMsg(wx.Frame):
def __set_properties(self):

    self.SetSize((300, 240))
    self.label_msg.SetMinSize((300, 200))
    self.button_cancel.SetMinSize((100, 40))
    self.button_ok.SetMinSize((100, 40))
   
def __init__(self, *args, **kwds):

    kwds["style"] = wx.DEFAULT_DIALOG_STYLE
    wx.Frame.__init__(self,*args, **kwds)
    self.label_msg = wx.StaticText(self, -1, "msg")
    self.button_cancel = wx.Button(self, -1, "Cancel")

    self.button_ok = wx.Button(self, -1, "OK")
    self.__set_properties()
    self.__do_layout()
   
def __do_layout(self):
    sizer_1 = wx.BoxSizer(wx.VERTICAL)
    sizer_2 = wx.BoxSizer(wx.HORIZONTAL)

    sizer_1.Add(self.label_msg, 0, wx.ALL|wx.EXPAND|wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 0)
    sizer_2.Add(self.button_cancel, 0, wx.ALIGN_RIGHT, 0)
    sizer_2.Add(self.button_ok, 0, wx.ALIGN_RIGHT, 0)

    sizer_1.Add(sizer_2, 1, wx.ALIGN_RIGHT|wx.ALIGN_BOTTOM, 0)
    self.SetSizer(sizer_1)
    self.Layout()

if name == “main”:
app = wx.PySimpleApp()
test = WinMsg(None, pos=(500,500))

test.Show()
test.Move((500,500))
app.MainLoop()  


Yours sincerely,

                                                                                                            Bertrand Lo