No lines seen on Windows M & wxPython 2.4.0.2 & python 2.2.2
Chris.
----- Original Message -----
From: Nigel Moriarty
To: wxPython-users
Sent: Wednesday, February 05, 2003 10:09 AM
Subject: [wxPython-users] wxScrollWindow Demo
Robin
It took me quite a while to get an example that demonstrated the
problem.
My really simple demos didn't, thus the complexity. You'll notice that
the
framework is from wxGlade but the canvas class is my own. The scrolling
leaves lines across the canvas.
Nigel
-------------------------------------------------------------------------
-------
#!/usr/bin/env python
# generated by wxGlade 0.1.3 on Mon Dec 09 12:49:10 2002
from wxPython.wx import *
class TaskTreeCtrl(wxPanel):
def __init__(self, *args, **kwds):
# begin wxGlade: __init__
wxPanel.__init__(self, *args, **kwds)
self.__set_properties()
self.__do_layout()
# end wxGlade
def __set_properties(self):
# begin wxGlade: __set_properties
pass
# end wxGlade
def __do_layout(self):
# begin wxGlade: __do_layout
pass
# end wxGlade
# end of class TaskTreeCtrl
class TaskNoteBookClass(wxNotebook):
def __init__(self, *args, **kwds):
# begin wxGlade: __init__
kwds["style"] = 0
wxNotebook.__init__(self, *args, **kwds)
self.task_tree_ctrl = TaskTreeCtrl(self, -1)
self.__set_properties()
self.__do_layout()
# end wxGlade
def __set_properties(self):
# begin wxGlade: __set_properties
nb_sizer = wxNotebookSizer(self)
self.AddPage(self.task_tree_ctrl, "tab1")
# end wxGlade
def __do_layout(self):
# begin wxGlade: __do_layout
pass
# end wxGlade
# end of class TaskNoteBookClass
class MenuWrapClass(wxPanel):
def __init__(self, *args, **kwds):
# begin wxGlade: __init__
wxPanel.__init__(self, *args, **kwds)
self.task_notebook = TaskNoteBookClass(self, -1)
self.__set_properties()
self.__do_layout()
# end wxGlade
def __set_properties(self):
# begin wxGlade: __set_properties
pass
# end wxGlade
def __do_layout(self):
# begin wxGlade: __do_layout
sizer_3 = wxBoxSizer(wxHORIZONTAL)
sizer_3.Add(self.task_notebook, 1, wxEXPAND, 0)
self.SetAutoLayout(1)
self.SetSizer(sizer_3)
sizer_3.Fit(self)
self.Layout()
# end wxGlade
# end of class MenuWrapClass
class TaskCanvas(wxPanel):
def __init__(self, *args, **kwds):
# begin wxGlade: __init__
wxPanel.__init__(self, *args, **kwds)
self.__set_properties()
self.__do_layout()
# end wxGlade
def __set_properties(self):
# begin wxGlade: __set_properties
self.SetBackgroundColour(wxColour(0, 0, 255))
# end wxGlade
def __do_layout(self):
# begin wxGlade: __do_layout
pass
# end wxGlade
# end of class TaskCanvas
class TaskCanvasClass(wxScrolledWindow):
"""
A canvas for tasks and strategies.
Tasks can be added and removed.
Tasks can be connected to the form strategies.
"""
def __init__(self, parent, id,
name="Canvas"):
self.parent = parent
wxScrolledWindow.__init__(self, parent, id, name=name)
self.SetWindowStyle(wxSUNKEN_BORDER|wxCLIP_CHILDREN)
self.SetBackgroundColour(wxColour(255,255,255))
self.thumb = 10
self.brush = wxBrush(wxColour(255,25,255))
self.Width = 1000
self.Height = 1000
self.SetScrollbars(self.thumb, self.thumb,
self.Width/self.thumb, self.Height/self.thumb)
EVT_PAINT(self, self.OnPaint)
EVT_ERASE_BACKGROUND(self, self.OnBackground)
def OnPaint(self, evt):
"""
Create a DC and ask Linker to draw any connections.
"""
dc=wxPaintDC(self)
self.PrepareDC(dc)
self.EraseBackground(dc)
self.Draw(dc)
def Draw(self, dc):
rPen = wxPen(wxColour(0,0,0),3)
rPen.SetCap(wxCAP_PROJECTING)
dc.SetPen(rPen)
dc.DrawRectangle(10,10,500,500)
def EraseBackground(self, dc):
dc.SetBackground(self.brush)
dc.Clear()
def OnBackground(self, evt):
try:
dc = evt.GetDC()
self.EraseBackground(dc)
except:
pass
class StrategyNotebookClass(wxNotebook):
def __init__(self, *args, **kwds):
# begin wxGlade: __init__
kwds["style"] = 0
wxNotebook.__init__(self, *args, **kwds)
self.task_canvas = TaskCanvasClass(self, -1)
self.__set_properties()
self.__do_layout()
# end wxGlade
def __set_properties(self):
# begin wxGlade: __set_properties
nb_sizer = wxNotebookSizer(self)
self.AddPage(self.task_canvas, "S1")
# end wxGlade
def __do_layout(self):
# begin wxGlade: __do_layout
pass
# end wxGlade
# end of class StrategyNotebookClass
class CanvasWrapClass(wxPanel):
def __init__(self, *args, **kwds):
# begin wxGlade: __init__
wxPanel.__init__(self, *args, **kwds)
self.StrategyNotebook = StrategyNotebookClass(self, -1)
self.__set_properties()
self.__do_layout()
# end wxGlade
def __set_properties(self):
# begin wxGlade: __set_properties
pass
# end wxGlade
def __do_layout(self):
# begin wxGlade: __do_layout
sizer_4 = wxBoxSizer(wxHORIZONTAL)
sizer_4.Add(self.StrategyNotebook, 1, wxEXPAND, 0)
self.SetAutoLayout(1)
self.SetSizer(sizer_4)
sizer_4.Fit(self)
self.Layout()
# end wxGlade
# end of class CanvasWrapClass
class StrategyWindowClass(wxSplitterWindow):
def __init__(self, *args, **kwds):
# begin wxGlade: __init__
kwds["style"] = wxSP_3D|wxSP_3DSASH|wxSP_3DBORDER
wxSplitterWindow.__init__(self, *args, **kwds)
self.canvas_wrap = CanvasWrapClass(self, -1)
self.menu_wrap = MenuWrapClass(self, -1)
self.__set_properties()
self.__do_layout()
# end wxGlade
def __set_properties(self):
# begin wxGlade: __set_properties
self.SplitVertically(self.menu_wrap, self.canvas_wrap)
self.SetSashPosition(124)
# end wxGlade
def __do_layout(self):
# begin wxGlade: __do_layout
pass
# end wxGlade
# end of class StrategyWindowClass
class InterfaceWrapClass(wxPanel):
def __init__(self, *args, **kwds):
# begin wxGlade: __init__
wxPanel.__init__(self, *args, **kwds)
self.splitter_window = StrategyWindowClass(self, -1)
self.__set_properties()
self.__do_layout()
# end wxGlade
def __set_properties(self):
# begin wxGlade: __set_properties
pass
# end wxGlade
def __do_layout(self):
# begin wxGlade: __do_layout
sizer_2 = wxBoxSizer(wxHORIZONTAL)
sizer_2.Add(self.splitter_window, 1, wxEXPAND, 0)
self.SetAutoLayout(1)
self.SetSizer(sizer_2)
sizer_2.Fit(self)
self.Layout()
# end wxGlade
# end of class InterfaceWrapClass
class MainNotebookClass(wxNotebook):
def __init__(self, *args, **kwds):
# begin wxGlade: __init__
kwds["style"] = 0
wxNotebook.__init__(self, *args, **kwds)
self.notebook_1_pane_1 = InterfaceWrapClass(self, -1)
self.__set_properties()
self.__do_layout()
# end wxGlade
def __set_properties(self):
# begin wxGlade: __set_properties
nb_sizer = wxNotebookSizer(self)
self.AddPage(self.notebook_1_pane_1, "strategy")
# end wxGlade
def __do_layout(self):
# begin wxGlade: __do_layout
pass
# end wxGlade
# end of class MainNotebookClass
class MyFrame(wxFrame):
def __init__(self, *args, **kwds):
# begin wxGlade: __init__
kwds["style"] = wxDEFAULT_FRAME_STYLE
wxFrame.__init__(self, *args, **kwds)
self.main_notebook = MainNotebookClass(self, -1)
self.frame_1_statusbar = self.CreateStatusBar(1)
# Menu Bar
self.frame_1_menubar = wxMenuBar()
self.SetMenuBar(self.frame_1_menubar)
wxglade_tmp_menu = wxMenu()
self.frame_1_menubar.Append(wxglade_tmp_menu, "File")
# Menu Bar end
self.__set_properties()
self.__do_layout()
# end wxGlade
def __set_properties(self):
# begin wxGlade: __set_properties
self.SetTitle("frame_1")
self.frame_1_statusbar.SetStatusWidths([-1])
# statusbar fields
frame_1_statusbar_fields = ['frame_1_statusbar']
for i in range(len(frame_1_statusbar_fields)):
self.frame_1_statusbar.SetStatusText(frame_1_statusbar_fields[i], i)
# end wxGlade
def __do_layout(self):
# begin wxGlade: __do_layout
main_sizer = wxBoxSizer(wxHORIZONTAL)
main_sizer.Add(self.main_notebook, 1, wxEXPAND, 0)
self.SetAutoLayout(1)
self.SetSizer(main_sizer)
main_sizer.Fit(self)
self.Layout()
# end wxGlade
# end of class MyFrame
class MyApp(wxApp):
def OnInit(self):
wxInitAllImageHandlers()
frame_1 = MyFrame(None, -1, "")
self.SetTopWindow(frame_1)
frame_1.Show(1)
return 1
# end of class MyApp
if __name__ == "__main__":
wxPhenix = MyApp()
wxPhenix.MainLoop()
-------------------------------------------------------------------------
-------