X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1e4a197e4c60e461b8068b0619692ea083e30b8b..908f8fc481c0503bf8be5002e5d5208666da7649:/wxPython/demo/DialogUnits.py?ds=sidebyside diff --git a/wxPython/demo/DialogUnits.py b/wxPython/demo/DialogUnits.py index 78974eb676..975eb175c0 100644 --- a/wxPython/demo/DialogUnits.py +++ b/wxPython/demo/DialogUnits.py @@ -10,46 +10,47 @@ # Copyright: (c) 1998 by Total Control Software # Licence: wxWindows license #---------------------------------------------------------------------------- +# - -## import all of the wxPython GUI package -from wxPython.wx import * - +import wx #--------------------------------------------------------------------------- -## Create a new frame class, derived from the wxPython Frame. -class MyFrame(wxFrame): +# Create a new frame class, derived from the wxPython Frame. +class MyFrame(wx.Frame): def __init__(self, parent, id, title): # First, call the base class' __init__ method to create the frame - wxFrame.__init__(self, parent, id, title, - wxPoint(100, 100), wxSize(160, 100)) + wx.Frame.__init__(self, parent, id, title, (100, 100), (160, 100)) # Associate some events with methods of this class - EVT_SIZE(self, self.OnSize) - EVT_MOVE(self, self.OnMove) - EVT_CLOSE(self, self.OnCloseWindow) + self.Bind(wx.EVT_SIZE, self.OnSize) + self.Bind(wx.EVT_MOVE, self.OnMove) + self.Bind(wx.EVT_CLOSE, self.OnCloseWindow) # Add a panel and some controls to display the size and position - panel = wxPanel(self, -1) - wxStaticText(panel, -1, "Size:", - wxDLG_PNT(panel, wxPoint(4, 4)), wxDefaultSize) - wxStaticText(panel, -1, "Pos:", - wxDLG_PNT(panel, wxPoint(4, 16)), wxDefaultSize) - self.sizeCtrl = wxTextCtrl(panel, -1, "", - wxDLG_PNT(panel, wxPoint(24, 4)), - wxDLG_SZE(panel, wxSize(36, -1)), - wxTE_READONLY) + panel = wx.Panel(self, -1) - self.posCtrl = wxTextCtrl(panel, -1, "", - wxDLG_PNT(panel, wxPoint(24, 16)), - wxDLG_SZE(panel, wxSize(36, -1)), - wxTE_READONLY) + wx.StaticText(panel, -1, "Size:", + wx.DLG_PNT(panel, (4, 4)), wx.DefaultSize + ) - #print wxDLG_PNT(panel, wxPoint(24, 4)), wxDLG_SZE(panel, wxSize(36, -1)) - #print wxDLG_PNT(panel, wxPoint(24, 16)),wxDLG_SZE(panel, wxSize(36, -1)) + wx.StaticText(panel, -1, "Pos:", + wx.DLG_PNT(panel, (4, 16)), wx.DefaultSize + ) + self.sizeCtrl = wx.TextCtrl(panel, -1, "", + wx.DLG_PNT(panel, (24, 4)), + wx.DLG_SZE(panel, (36, -1)), + wx.TE_READONLY) + + self.posCtrl = wx.TextCtrl(panel, -1, "", + wx.DLG_PNT(panel, (24, 16)), + wx.DLG_SZE(panel, (36, -1)), + wx.TE_READONLY) + + #print wx.DLG_PNT(panel, (24, 4)), wx.DLG_SZE(panel, (36, -1)) + #print wx.DLG_PNT(panel, (24, 16)),wx.DLG_SZE(panel, (36, -1)) # This method is called automatically when the CLOSE event is # sent to this window @@ -57,7 +58,6 @@ class MyFrame(wxFrame): # tell the window to kill itself self.Destroy() - # This method is called by the System when the window is resized, # because of the association above. def OnSize(self, event): @@ -81,7 +81,7 @@ class MyFrame(wxFrame): if __name__ == "__main__": # Every wxWindows application must have a class derived from wxApp - class MyApp(wxApp): + class MyApp(wx.App): # wxWindows calls this method to initialize the application def OnInit(self):