From 0d575a5dfaff72e6cbf20862e39f1912e0de2229 Mon Sep 17 00:00:00 2001
From: Robin Dunn
-The MakeActiveXClass function dynamically builds a new Class on the fly, that has the
-same signature and semantics as wxWindow. This means that when you call the function
-you get back a new class that you can use just like wxWindow, (set the size and position,
-use in a sizer, etc.) except its contents will be the COM control.
-
-This demo embeds the Adobe Acrobat Reader, and gives you some buttons for opening a PDF
-file, changing pages, etc. that show how to call methods on the COM object. If you don't
-have Acrobat Reader 4.0 installed it won't work.
-
-"""
-
-import sys
-import wx
-
-if wx.Platform == '__WXMSW__':
- import wx.lib.activexwrapper as ax
- import win32com.client.gencache
-
- try:
- acrobat = win32com.client.gencache.EnsureModule(
- '{CA8A9783-280D-11CF-A24D-444553540000}', 0x0, 1, 3
- )
- except:
- raise ImportError("Can't load PDF.OCX, install Acrobat 4.0")
-
-
-#----------------------------------------------------------------------
-
-class TestPanel(wx.Panel):
- def __init__(self, parent, log):
- wx.Panel.__init__(self, parent, -1)
- self.pdf = None
-
- sizer = wx.BoxSizer(wx.VERTICAL)
- btnSizer = wx.BoxSizer(wx.HORIZONTAL)
-
- # this function creates a new class that can be used as
- # a wx.Window, but contains the given ActiveX control.
- ActiveXWrapper = ax.MakeActiveXClass(acrobat.Pdf)
-
- # create an instance of the new class
- self.pdf = ActiveXWrapper( self, -1, style=wx.SUNKEN_BORDER)
-
- sizer.Add(self.pdf, proportion=1, flag=wx.EXPAND)
-
- btn = wx.Button(self, wx.NewId(), "Open PDF File")
- self.Bind(wx.EVT_BUTTON, self.OnOpenButton)
- btnSizer.Add(btn, proportion=1, flag=wx.EXPAND|wx.ALL, border=5)
-
- btn = wx.Button(self, wx.NewId(), "<-- Previous Page")
- self.Bind(wx.EVT_BUTTON, self.OnPrevPageButton, id=btn.GetId())
- btnSizer.Add(btn, proportion=1, flag=wx.EXPAND|wx.ALL, border=5)
-
- btn = wx.Button(self, wx.NewId(), "Next Page -->")
- self.Bind(wx.EVT_BUTTON, self.OnNextPageButton, id=btn.GetId())
- btnSizer.Add(btn, proportion=1, flag=wx.EXPAND|wx.ALL, border=5)
-
-
- btnSizer.Add((50,-1), proportion=2, flag=wx.EXPAND)
- sizer.Add(btnSizer, proportion=0, flag=wx.EXPAND)
-
- self.SetSizer(sizer)
- self.SetAutoLayout(True)
-
- self.Bind(wx.EVT_WINDOW_DESTROY, self.OnDestroy)
-
-
- def OnDestroy(self, evt):
- if self.pdf:
- self.pdf.Cleanup()
- self.pdf = None
-
-
-
- def OnOpenButton(self, event):
- dlg = wx.FileDialog(self, wildcard="*.pdf")
-
- if dlg.ShowModal() == wx.ID_OK:
- wx.BeginBusyCursor()
- self.pdf.LoadFile(dlg.GetPath())
- wx.EndBusyCursor()
-
- dlg.Destroy()
-
-
- def OnPrevPageButton(self, event):
- self.pdf.gotoPreviousPage()
-
-
- def OnNextPageButton(self, event):
- self.pdf.gotoNextPage()
-
-
-
-#----------------------------------------------------------------------
-
-def runTest(frame, nb, log):
- if wx.Platform == '__WXMSW__':
- win = TestPanel(nb, log)
- return win
- else:
- dlg = wx.MessageDialog(frame, 'This demo only works on MSW.',
- 'Sorry', wx.OK | wx.ICON_INFORMATION)
- dlg.ShowModal()
- dlg.Destroy()
-
-
-overview = __doc__
-
-#----------------------------------------------------------------------
-
-
-if __name__ == '__main__':
- class TestFrame(wx.Frame):
- def __init__(self):
- wx.Frame.__init__(
- self, None, -1, "ActiveX test -- Acrobat", size=(640, 480),
- style=wx.DEFAULT_FRAME_STYLE|wx.NO_FULL_REPAINT_ON_RESIZE
- )
-
- self.tp = TestPanel(self, sys.stdout)
-
-
- app = wx.PySimpleApp()
- frame = TestFrame()
- frame.Show(True)
- app.MainLoop()
-
-
diff --git a/wxPython/demo/ActiveXWrapper_IE.py b/wxPython/demo/ActiveXWrapper_IE.py
deleted file mode 100644
index 02317ac11d..0000000000
--- a/wxPython/demo/ActiveXWrapper_IE.py
+++ /dev/null
@@ -1,246 +0,0 @@
-"""
-
-The MakeActiveXClass function dynamically builds a new Class on the
-fly, that has the same signature and semantics as wxWindow. This
-means that when you call the function you get back a new class that
-you can use just like wxWindow, (set the size and position, use in a
-sizer, etc.) except its contents will be the COM control.
-
-
-This demo embeds the Internet Explorer WebBrowser control, and shows
-how to receive events from the COM control. (The title bar and status
-bar are updated as pages change, in addition to the log messages being
-shown.)
-
-"""
-
-import sys
-import wx
-
-if wx.Platform == '__WXMSW__':
- import wx.lib.activexwrapper as ax
- import win32com.client.gencache
-
- try:
- browserModule = win32com.client.gencache.EnsureModule(
- "{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}", 0, 1, 1
- )
- except:
- raise ImportError("IE4 or greater does not appear to be installed.")
-
-
-#----------------------------------------------------------------------
-
-class TestPanel(wx.Window):
- def __init__(self, parent, log, frame=None):
- wx.Window.__init__(
- self, parent, -1,
- style=wx.CLIP_CHILDREN|wx.NO_FULL_REPAINT_ON_RESIZE
- )
-
- self.ie = None
- self.log = log
- self.current = "http://wxPython.org/"
- self.frame = frame
-
- if frame:
- self.titleBase = frame.GetTitle()
-
- sizer = wx.BoxSizer(wx.VERTICAL)
- btnSizer = wx.BoxSizer(wx.HORIZONTAL)
-
- # Make a new class that derives from the WebBrowser class in the
- # COM module imported above. This class also derives from wxWindow and
- # implements the machinery needed to integrate the two worlds.
- theClass = ax.MakeActiveXClass(
- browserModule.WebBrowser, eventObj = self
- )
-
- # Create an instance of that class
- self.ie = theClass(self, -1) ##, style=wxSUNKEN_BORDER)
-
-
- btn = wx.Button(self, wx.NewId(), "Open", style=wx.BU_EXACTFIT)
- self.Bind(wx.EVT_BUTTON, self.OnOpenButton, id=btn.GetId())
- btnSizer.Add(btn, 0, wx.EXPAND|wx.ALL, 2)
-
- btn = wx.Button(self, wx.NewId(), "Home", style=wx.BU_EXACTFIT)
- self.Bind(wx.EVT_BUTTON, self.OnHomeButton, id=btn.GetId())
- btnSizer.Add(btn, 0, wx.EXPAND|wx.ALL, 2)
-
- btn = wx.Button(self, wx.NewId(), "<--", style=wx.BU_EXACTFIT)
- self.Bind(wx.EVT_BUTTON, self.OnPrevPageButton, id=btn.GetId())
- btnSizer.Add(btn, 0, wx.EXPAND|wx.ALL, 2)
-
- btn = wx.Button(self, wx.NewId(), "-->", style=wx.BU_EXACTFIT)
- self.Bind(wx.EVT_BUTTON, self.OnNextPageButton, id=btn.GetId())
- btnSizer.Add(btn, 0, wx.EXPAND|wx.ALL, 2)
-
- btn = wx.Button(self, wx.NewId(), "Stop", style=wx.BU_EXACTFIT)
- self.Bind(wx.EVT_BUTTON, self.OnStopButton, id=btn.GetId())
- btnSizer.Add(btn, 0, wx.EXPAND|wx.ALL, 2)
-
- btn = wx.Button(self, wx.NewId(), "Search", style=wx.BU_EXACTFIT)
- self.Bind(wx.EVT_BUTTON, self.OnSearchPageButton, id=btn.GetId())
- btnSizer.Add(btn, 0, wx.EXPAND|wx.ALL, 2)
-
- btn = wx.Button(self, wx.NewId(), "Refresh", style=wx.BU_EXACTFIT)
- self.Bind(wx.EVT_BUTTON, self.OnRefreshPageButton, id=btn.GetId())
- btnSizer.Add(btn, 0, wx.EXPAND|wx.ALL, 2)
-
- txt = wx.StaticText(self, -1, "Location:")
- btnSizer.Add(txt, 0, wx.CENTER|wx.ALL, 2)
-
- self.location = wx.ComboBox(self, wx.NewId(), "", style=wx.CB_DROPDOWN)
- self.Bind(wx.EVT_COMBOBOX, self.OnLocationSelect, id=self.location.GetId())
- self.Bind(wx.EVT_KEY_UP, self.OnLocationKey, self.location)
- self.Bind(wx.EVT_CHAR, self.IgnoreReturn, self.location)
- btnSizer.Add(self.location, 1, wx.EXPAND|wx.ALL, 2)
-
- sizer.Add(btnSizer, 0, wx.EXPAND)
- sizer.Add(self.ie, 1, wx.EXPAND)
-
- self.ie.Navigate(self.current)
- self.location.Append(self.current)
-
- self.SetSizer(sizer)
- self.SetAutoLayout(True)
- self.Bind(wx.EVT_SIZE, self.OnSize)
- self.Bind(wx.EVT_WINDOW_DESTROY, self.OnDestroy)
-
-
- def ShutdownDemo(self):
- # put the frame title back
- if self.frame:
- self.frame.SetTitle(self.titleBase)
-
-
- def OnDestroy(self, evt):
- if self.ie:
- self.ie.Cleanup()
- self.ie = None
- self.frame = None
-
-
- def OnSize(self, evt):
- self.Layout()
-
-
- def OnLocationSelect(self, evt):
- url = self.location.GetStringSelection()
- self.log.write('OnLocationSelect: %s\n' % url)
- self.ie.Navigate(url)
-
- def OnLocationKey(self, evt):
- if evt.KeyCode() == wx.WXK_RETURN:
- URL = self.location.GetValue()
- self.location.Append(URL)
- self.ie.Navigate(URL)
- else:
- evt.Skip()
-
- def IgnoreReturn(self, evt):
- print 'IgnoreReturn'
- if evt.KeyCode() != wx.WXK_RETURN:
- evt.Skip()
-
- def OnOpenButton(self, event):
- dlg = wx.TextEntryDialog(self, "Open Location",
- "Enter a full URL or local path",
- self.current, wx.OK|wx.CANCEL)
-
- dlg.CentreOnParent()
-
- if dlg.ShowModal() == wx.ID_OK:
- self.current = dlg.GetValue()
- self.ie.Navigate(self.current)
-
- dlg.Destroy()
-
- def OnHomeButton(self, event):
- self.ie.GoHome() ## ET Phone Home!
-
- def OnPrevPageButton(self, event):
- self.ie.GoBack()
-
- def OnNextPageButton(self, event):
- self.ie.GoForward()
-
- def OnStopButton(self, evt):
- self.ie.Stop()
-
- def OnSearchPageButton(self, evt):
- self.ie.GoSearch()
-
- def OnRefreshPageButton(self, evt):
- self.ie.Refresh2(3)
-
-
- # The following event handlers are called by the web browser COM
- # control since we passed self to MakeActiveXClass. It will look
- # here for matching attributes and call them if they exist. See the
- # module generated by makepy for details of method names, etc.
- def OnBeforeNavigate2(self, pDisp, URL, *args):
- self.log.write('OnBeforeNavigate2: %s\n' % URL)
-
- def OnNavigateComplete2(self, pDisp, URL):
- self.log.write('OnNavigateComplete2: %s\n' % URL)
- self.current = URL
- self.location.SetValue(URL)
-
- def OnTitleChange(self, text):
- self.log.write('OnTitleChange: %s\n' % text)
- if self.frame:
- self.frame.SetTitle(self.titleBase + ' -- ' + text)
-
- def OnStatusTextChange(self, text):
- self.log.write('OnStatusTextChange: %s\n' % text)
- if self.frame:
- self.frame.SetStatusText(text)
-
-
-#----------------------------------------------------------------------
-# for the demo framework...
-
-def runTest(frame, nb, log):
- if wx.Platform == '__WXMSW__':
- win = TestPanel(nb, log, frame)
- return win
- else:
- dlg = wx.MessageDialog(frame, 'This demo only works on MSW.',
- 'Sorry', wx.OK | wx.ICON_INFORMATION)
- dlg.ShowModal()
- dlg.Destroy()
-
-
-overview = __doc__
-
-#----------------------------------------------------------------------
-
-
-if __name__ == '__main__':
- class TestFrame(wx.Frame):
- def __init__(self):
- wx.Frame.__init__(
- self, None, -1, "ActiveX test -- Internet Explorer",
- size=(640, 480),
- style=wx.DEFAULT_FRAME_STYLE|wx.NO_FULL_REPAINT_ON_RESIZE
- )
-
- self.CreateStatusBar()
- self.tp = TestPanel(self, sys.stdout, self)
- self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
-
- def OnCloseWindow(self, evt):
- self.tp.Destroy()
- self.Destroy()
-
- app = wx.PySimpleApp()
- frame = TestFrame()
- frame.Show(True)
- app.MainLoop()
-
diff --git a/wxPython/demo/ErrorDialogs.py b/wxPython/demo/ErrorDialogs.py
deleted file mode 100644
index f264f8f92f..0000000000
--- a/wxPython/demo/ErrorDialogs.py
+++ /dev/null
@@ -1,197 +0,0 @@
-# demo for ErrorDialogs.py
-# usual wxWindows license stuff here.
-# by Chris Fama, with thanks to Robin Dunn, and others on the wxPython-users
-# mailing list.
-#
-# 11/22/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
-# 11/25/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Looks like we have issues until the library is updated.
-# - Had to rename back to wx* naming conventions
-# - Getting unusual failures in the library itself when that is done.
-#
-
-import sys
-
-import wx
-import wx.lib.ErrorDialogs as edlg
-
-_debug = 0
-
-ID_TEXT = 10000
-ID_BUTTON_wxPyNonFatalError = 10001
-ID_BUTTON_wxPyFatalError = 10002
-ID_BUTTON_wxPyFatalErrorDialog = 10003
-ID_BUTTON_wxPyNonFatalErrorDialog = 10004
-ID_BUTTON_wxPyFatalErrorDialogWithTraceback = 10005
-ID_BUTTON_wxPyNonFatalErrorDialogWithTraceback = 10006
-
-def ErrorDialogsDemoPanelFunc( parent, call_fit = True, set_sizer = True ):
- item0 = wx.BoxSizer( wx.VERTICAL )
-
- item1 = wx.StaticText(
- parent, ID_TEXT,
- "Please select one of the buttons below for an example using explicit errors..."
- )
-
- item0.AddWindow( item1, 0, wx.ALIGN_CENTRE|wx.ALL, 5 )
-
- item2 = wx.FlexGridSizer( 0, 2, 0, 0 )
-
- item3 = wx.Button( parent, ID_BUTTON_wxPyNonFatalError, "wxPyNonFatalError")
- item2.AddWindow( item3, 0, wx.ALIGN_CENTRE|wx.ALL, 5 )
-
- item4 = wx.Button( parent, ID_BUTTON_wxPyFatalError, "wxPyFatalError")
- item2.AddWindow( item4, 0, wx.ALIGN_CENTRE|wx.ALL, 5 )
-
- item0.AddSizer( item2, 0, wx.ALIGN_CENTRE|wx.ALL, 5 )
-
- item5 = wx.StaticText( parent, ID_TEXT, "Please select one of the buttons below for interpreter errors...")
- item0.AddWindow( item5, 0, wx.ALIGN_CENTRE|wx.ALL, 5 )
-
- item6 = wx.FlexGridSizer( 0, 2, 0, 0 )
-
- item7 = wx.Button( parent, ID_BUTTON_wxPyFatalErrorDialog, "wxPyFatalErrorDialog")
- item6.AddWindow( item7, 0, wx.ALIGN_CENTRE|wx.ALL, 5 )
-
- item8 = wx.Button( parent, ID_BUTTON_wxPyNonFatalErrorDialog, "wxPyNonFatalErrorDialog")
- item6.AddWindow( item8, 0, wx.ALIGN_CENTRE|wx.ALL, 5 )
-
- item9 = wx.Button(
- parent, ID_BUTTON_wxPyFatalErrorDialogWithTraceback,
- "wxPyFatalErrorDialogWithTraceback"
- )
- item6.AddWindow( item9, 0, wx.ALIGN_CENTRE|wx.ALL, 5 )
-
- item10 = wx.Button(
- parent, ID_BUTTON_wxPyNonFatalErrorDialogWithTraceback,
- "wxPyNonFatalErrorDialogWithTraceback"
- )
- item10.SetDefault()
- item6.AddWindow( item10, 0, wx.ALIGN_CENTRE|wx.ALL, 5 )
-
- item0.AddSizer( item6, 0, wx.ALIGN_CENTRE|wx.ALL, 5 )
-
- item11 = wx.FlexGridSizer( 0, 2, 0, 0 )
-
- item0.AddSizer( item11, 0, wx.ALIGN_CENTRE|wx.ALL, 5 )
-
- if set_sizer == True:
- parent.SetAutoLayout( True )
- parent.SetSizer( item0 )
- if call_fit == True:
- item0.Fit( parent )
- item0.SetSizeHints( parent )
-
- return item0
-
-# Menu bar functions
-
-# Bitmap functions
-
-
-# End of generated file
-
-class MyPanel(wx.Panel):
- def __init__(self,parent=None):
- wx.Panel.__init__(self,parent,-1)
-
- args = (None, -1)
- kwargs = {
- 'programname': "sumthing",
- 'mailto': "me@sumwear",
- 'whendismissed': "from wxPython.wx import * ; wxBell()"
- }
-
- self.dialogs = map(apply,
- [edlg.wxPyNonFatalErrorDialogWithTraceback,
- edlg.wxPyNonFatalErrorDialog,#WithTraceback
- edlg.wxPyFatalErrorDialogWithTraceback,
- edlg.wxPyFatalErrorDialog #WithTraceback
- ],
- (args,) * 4,
- (kwargs,) * 4
- )
-
- ErrorDialogsDemoPanelFunc(self)
-
- self.Bind(wx.EVT_BUTTON, self.DoDialog, id=ID_BUTTON_wxPyFatalErrorDialog)
- self.Bind(wx.EVT_BUTTON, self.DoDialog, id=ID_BUTTON_wxPyNonFatalError)
- self.Bind(wx.EVT_BUTTON, self.DoDialog, id=ID_BUTTON_wxPyFatalError)
- self.Bind(wx.EVT_BUTTON, self.DoDialog, id=ID_BUTTON_wxPyFatalErrorDialogWithTraceback)
- self.Bind(wx.EVT_BUTTON, self.DoDialog, id=ID_BUTTON_wxPyNonFatalErrorDialog)
- self.Bind(wx.EVT_BUTTON, self.DoDialog, id=ID_BUTTON_wxPyNonFatalErrorDialogWithTraceback)
-
- IndexFromID = {
- ID_BUTTON_wxPyFatalErrorDialog: 3,
- ID_BUTTON_wxPyFatalErrorDialogWithTraceback: 2,
- ID_BUTTON_wxPyNonFatalErrorDialog: 1,
- ID_BUTTON_wxPyNonFatalErrorDialogWithTraceback: 0
- }
-
- def DoDialog(self,event):
- id = event.GetId()
-
- if id in [ID_BUTTON_wxPyFatalError,ID_BUTTON_wxPyNonFatalError]:
- if id == ID_BUTTON_wxPyFatalError:
- print "%s.DoDialog(): testing explicit wxPyFatalError..."\
- % self
- edlg.wxPyFatalError(self,"Test Non-fatal error. "
- "Nearly arbitrary HTML (i.e., that which is"
- " understood by wxHtmlWindow)."
- " "
- "This is a table
" - "Nearly arbitrary HTML (i.e., that which is" - " understood by wxHtmlWindow)." - "
This | is |
a | table |
Using this class is simpler than ActiveXWrapper, doesn't rely on
-the win32all extensions, and is more "wx\'ish", meaning that it uses
-events and etc. as would be expected from any other wx window.
-
-
-"""
-
-
-
-if __name__ == '__main__':
- import sys,os
- import run
- run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])
-
-
-#----------------------------------------------------------------------
-
diff --git a/wxPython/demo/Main.py b/wxPython/demo/Main.py
index f813bf1431..733baf9f53 100644
--- a/wxPython/demo/Main.py
+++ b/wxPython/demo/Main.py
@@ -71,7 +71,6 @@ _treeList = [
# dialogs from libraries
('More Dialogs', [
- ##'ErrorDialogs',
'ImageBrowser',
'MultipleChoiceDialog',
'ScrolledMessageDialog',
@@ -143,7 +142,6 @@ _treeList = [
'FloatBar',
'FloatCanvas',
'HtmlWindow',
- ##'IEHtmlWin',
'IntCtrl',
'MVCTree',
'MaskedEditControls',
@@ -180,7 +178,6 @@ _treeList = [
('Process and Events', [
'EventManager',
'KeyEvents',
- ##'OOR',
'Process',
'PythonEvents',
'Threads',
@@ -225,10 +222,7 @@ _treeList = [
# need libs not coming with the demo
('Objects using an external library', [
- ##'ActiveXWrapper_Acrobat',
- ##'ActiveXWrapper_IE', # currently has tstate problems...
'GLCanvas',
- #'PlotCanvas', # deprecated, use PyPlot
]),
diff --git a/wxPython/demo/OOR.py b/wxPython/demo/OOR.py
deleted file mode 100644
index 547869a1c3..0000000000
--- a/wxPython/demo/OOR.py
+++ /dev/null
@@ -1,155 +0,0 @@
-
-import wx
-import wx.html as wxhtml
-
-#----------------------------------------------------------------------
-
-BTN1 = wx.NewId()
-BTN2 = wx.NewId()
-
-class TestPanel(wx.Panel):
- def __init__(self, parent, log):
- wx.Panel.__init__(self, parent, -1)
- self.log = log
-
- sizer = wx.BoxSizer(wx.VERTICAL)
- html = wxhtml.HtmlWindow(self, -1)
- html.SetPage(overview)
- sizer.Add(html, 1, wx.EXPAND|wx.ALL, 5)
-
- btns = wx.BoxSizer(wx.HORIZONTAL)
- btns.Add((50, -1), 1, wx.EXPAND)
- btn1 = wx.Button(self, BTN1, "Find My Alter-ego") # don't save a ref to this one
- btns.Add(btn1)
- btns.Add((50, -1), 1, wx.EXPAND)
- self.btn2 = wx.Button(self, BTN2, "Find Myself")
- btns.Add(self.btn2)
- btns.Add((50, -1), 1, wx.EXPAND)
-
- sizer.Add(btns, 0, wx.EXPAND|wx.ALL, 15)
-
- self.SetSizer(sizer)
- self.SetAutoLayout(True)
-
- self.sizer = sizer # save it for testing later
-
- self.Bind(wx.EVT_BUTTON, self.OnFindButton1, id=BTN1)
- self.Bind(wx.EVT_BUTTON, self.OnFindButton2, id=BTN2)
-
-
- def OnFindButton1(self, evt):
- win = self.FindWindowById(BTN1)
-
- if win is None:
- self.log.write("***** OOPS! None returned...\n")
- return
-
- className = win.__class__.__name__
-
- if className in ["Button", "ButtonPtr"]:
- self.log.write("The types are the same! Several methods in wxWindows return pointers to base class objects,
-when in fact the actual object pointed to is of a derived type. Since
-SWIG isn't able to tell the actual type it just creates a new Python
-shadow object of the base type to wrap around the base type pointer
-and returns it.
-
- In wxPython prior to 2.3.0 this could cause annoying issues. For
-example if you called:
-
- Even with wxPyTypeCast there was the issue that the object returned
-was not the same one that was created in Python originally, but a new
-object of the same type that wraps the same C++ pointer. If the
-programmer has set additional attributes of that original object they
-will not exist in the new object.
-
- For a long time now I have wanted to do away with wxPyTypeCast and
-also find a way to return the original Python object from methods like
-FindWindowById. This project naturally divides into two phases:
-
- The first button below shows the first of these phases (working)
-and the second will show #2 (working as of Python 2.3.2)
-
-
-"""
-
-
-
-
-if __name__ == '__main__':
- import sys,os
- import run
- run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])
-
diff --git a/wxPython/demo/PlotCanvas.py b/wxPython/demo/PlotCanvas.py
deleted file mode 100644
index 3c2a2a9ea9..0000000000
--- a/wxPython/demo/PlotCanvas.py
+++ /dev/null
@@ -1,51 +0,0 @@
-
-#
-# wx.lib.wxPlotCanvas is deprecated. Use wx.lib.plot instead.
-#
-
-import wx
-import wx.lib.wxPlotCanvas as plot
-
-import Numeric
-
-#---------------------------------------------------------------------------
-
-def _InitObjects():
- # 100 points sin function, plotted as green circles
- data1 = 2.*Numeric.pi*Numeric.arange(200)/200.
- data1.shape = (100, 2)
- data1[:,1] = Numeric.sin(data1[:,0])
- markers1 = plot.PolyMarker(data1, color='green', marker='circle',size=1)
-
- # 50 points cos function, plotted as red line
- data1 = 2.*Numeric.pi*Numeric.arange(100)/100.
- data1.shape = (50,2)
- data1[:,1] = Numeric.cos(data1[:,0])
- lines = plot.PolyLine(data1, color='red')
-
- # A few more points...
- pi = Numeric.pi
- markers2 = plot.PolyMarker([(0., 0.), (pi/4., 1.), (pi/2, 0.),
- (3.*pi/4., -1)], color='blue',
- fillcolor='green', marker='cross')
-
- return plot.PlotGraphics([markers1, lines, markers2])
-
-
-#---------------------------------------------------------------------------
-
-
-def runTest(frame, nb, log):
- win = plot.PlotCanvas(nb)
- win.draw(_InitObjects(),'automatic','automatic');
- return win
-
-overview = plot.__doc__
-
-#---------------------------------------------------------------------------
-
-
-if __name__ == '__main__':
- import sys,os
- import run
- run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])
--
2.45.2
Original Object Return
-
-
-
- myText = someWindow.FindWindowById(txtID)
-
-
-expecting to get a wxTextCtrl you would actually get a wxWindow object
-instead. If you then try to call SetValue on that object you'll get
-an exception since there is no such method. This is the reason for
-the wxPyTypeCast hack that has been in wxPython for so long.
-
-
-
-
-
-