Hi
I'm trying to make my first wxPython app. Basically I've just used the
same code as the wxOGL, only a lot simpler. But for some reason it won't
work properly.
- The scrollbar doesn't show
- The circle doesn't show
- The whole app crashes when I try no minimize!
Here's the code:
from wxPython.wx import *
from wxPython.ogl import *
wxOGLInitialize()
class OOPPCanvas(wxShapeCanvas):
def __init__(self, parent, log, frame):
wxShapeCanvas.__init__(self, parent)
maxWidth = 1000
maxHeight = 1000
self.SetScrollbars(20, 20, maxWidth/20, maxHeight/20)
self.frame = frame
self.SetBackgroundColour("LIGHT BLUE")
self.diagram = wxDiagram()
self.SetDiagram(self.diagram)
self.diagram.SetCanvas(self)
circle = wxCircleShape(100)
circle.SetCavas(self)
self.diagram.AddShape(circle)
shape.Show(True)
EVT_WINDOW_DESTROY(self, self.OnDestroy)
class OOPPFrame(wxFrame):
def __init__(self, *args, **kwds):
wxFrame.__init__(self, *args, **kwds)
self.__set_properties()
#self.__do_layout()
self.canvas = wxShapeCanvas(self)
def __set_properties(self):
self.SetTitle("OOPP Studio")
self.SetBackgroundColour(wxColour(8, 197, 248))
def __do_layout(self):
self.Layout()
# end of class OOPPFrame
class OOPPGUI(wxApp):
def OnInit(self):
#wxInitAllImageHandlers()
frame = OOPPFrame(None, -1, "")
self.SetTopWindow(frame)
frame.Show(1)
return 1
# end of class OOPPGUI
if __name__ == "__main__":
app = OOPPGUI()
app.MainLoop()