Demo updates for new wx namespace, from Jeff Grimmett
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@24723 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
		@@ -10,46 +10,50 @@
 | 
			
		||||
# Copyright:    (c) 1998 by Total Control Software
 | 
			
		||||
# Licence:      wxWindows license
 | 
			
		||||
#----------------------------------------------------------------------------
 | 
			
		||||
# Updated 11/9/2003 by Jeff Grimmett (grimmtooth@softhome.net)
 | 
			
		||||
#
 | 
			
		||||
# o Converted for V2.5 compatability
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## 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 +61,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 +84,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):
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user