X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f57d79324999185323ec41a636a7cdc87a651f98..d9f39e09e82e99c422619f4e3df536d0a9e87987:/utils/wxPython/tests/test3.py diff --git a/utils/wxPython/tests/test3.py b/utils/wxPython/tests/test3.py index 39dba9b3bb..da57af5baa 100644 --- a/utils/wxPython/tests/test3.py +++ b/utils/wxPython/tests/test3.py @@ -12,41 +12,44 @@ #---------------------------------------------------------------------------- -from wxPython import * +from wxPython.wx import * #--------------------------------------------------------------------------- class MyCanvas(wxWindow): + def __init__(self, parent, ID): + wxWindow.__init__(self, parent, ID) + self.SetBackgroundColour(wxNamedColor("WHITE")) + def OnPaint(self, event): dc = wxPaintDC(self) dc.BeginDrawing() - w, h = self.GetClientSize() + size = self.GetClientSize() font = wxFont(42, wxSWISS, wxNORMAL, wxNORMAL) dc.SetFont(font) st = "Python Rules!" - tw,th, d,e = dc.GetTextExtent(st) - dc.DrawText(st, (w-tw)/2, (h-th)/2) + tw,th = dc.GetTextExtent(st) + dc.DrawText(st, (size.width-tw)/2, (size.height-th)/2) dc.EndDrawing() #--------------------------------------------------------------------------- -if wxPlatform == '__WXMSW__': - class MyMiniFrame(wxMiniFrame): - def __init__(self, parent, ID, title, pos, size, style): - wxMiniFrame.__init__(self, parent, ID, title, pos, size, style) - panel = wxPanel(self, -1) - ID = NewId() - button = wxButton(panel, ID, "Close Me") - button.SetPosition(wxPoint(15, 15)) - self.Connect(ID, -1, wxEVT_COMMAND_BUTTON_CLICKED, self.OnCloseMe) - - def OnCloseMe(self, event): - self.Close(true) +#if wxPlatform == '__WXMSW__': +class MyMiniFrame(wxMiniFrame): + def __init__(self, parent, ID, title, pos, size, style): + wxMiniFrame.__init__(self, parent, ID, title, pos, size, style) + panel = wxPanel(self, -1) + ID = NewId() + button = wxButton(panel, ID, "Close Me") + button.SetPosition(wxPoint(15, 15)) + self.Connect(ID, -1, wxEVT_COMMAND_BUTTON_CLICKED, self.OnCloseMe) - def OnCloseWindow(self, event): - self.Destroy() + def OnCloseMe(self, event): + self.Close(true) + def OnCloseWindow(self, event): + self.Destroy() #--------------------------------------------------------------------------- class MyFrame(wxFrame): @@ -54,7 +57,7 @@ class MyFrame(wxFrame): wxFrame.__init__(self, parent, id, title, wxPyDefaultPosition, wxSize(420, 200)) self.canvas = MyCanvas(self, -1) - self.CreateStatusBar(3) + self.CreateStatusBar(2) mainmenu = wxMenuBar() menu = wxMenu() menu.Append(100, 'A &Menu Item', 'the help text') @@ -80,9 +83,9 @@ class MyFrame(wxFrame): def OnSize(self, event): - w,h = self.GetClientSize() - self.canvas.SetSize(wxSize(w, h)) - self.SetStatusText("hello, this is a test: (%d, %d)" % (w,h)) + size = self.GetClientSize() + self.canvas.SetSize(size) + self.SetStatusText("hello, this is a test: (%d, %d)" % (size.width, size.height), 1) ## def OnMenuHighlight(self, event): ## mainmenu = self.GetMenuBar() @@ -95,7 +98,7 @@ class MyFrame(wxFrame): if event.GetInt() == 200: self.Close() elif event.GetInt() == 101: - if wxPlatform == '__WXMSW__': + #if wxPlatform == '__WXMSW__': win = MyMiniFrame(self, -1, "This is a Mini...", wxPoint(-1, -1), #wxPyDefaultPosition, wxSize(150, 150), @@ -103,8 +106,8 @@ class MyFrame(wxFrame): wxTHICK_FRAME | wxSYSTEM_MENU | wxTINY_CAPTION_HORIZ) win.Show(true) - else: - print 'Sorry, can\'t do mini\'s...' + #else: + # print 'Sorry, can\'t do mini\'s...' @@ -143,6 +146,45 @@ if __name__ == '__main__': #---------------------------------------------------------------------------- # # $Log$ +# Revision 1.6 1999/04/30 03:29:53 RD +# wxPython 2.0b9, first phase (win32) +# Added gobs of stuff, see wxPython/README.txt for details +# +# Revision 1.5 1999/02/20 09:04:43 RD +# Added wxWindow_FromHWND(hWnd) for wxMSW to construct a wxWindow from a +# window handle. If you can get the window handle into the python code, +# it should just work... More news on this later. +# +# Added wxImageList, wxToolTip. +# +# Re-enabled wxConfig.DeleteAll() since it is reportedly fixed for the +# wxRegConfig class. +# +# As usual, some bug fixes, tweaks, etc. +# +# Revision 1.4 1998/12/16 22:12:46 RD +# +# Tweaks needed to be able to build wxPython with wxGTK. +# +# Revision 1.3 1998/12/15 20:44:35 RD +# Changed the import semantics from "from wxPython import *" to "from +# wxPython.wx import *" This is for people who are worried about +# namespace pollution, they can use "from wxPython import wx" and then +# prefix all the wxPython identifiers with "wx." +# +# Added wxTaskbarIcon for wxMSW. +# +# Made the events work for wxGrid. +# +# Added wxConfig. +# +# Added wxMiniFrame for wxGTK, (untested.) +# +# Changed many of the args and return values that were pointers to gdi +# objects to references to reflect changes in the wxWindows API. +# +# Other assorted fixes and additions. +# # Revision 1.2 1998/08/22 19:51:17 RD # some tweaks for wxGTK #