Hi,
I have problems attaching a floatcanvas/navcanvas on a wxpanel. I've attached my code and what I'm trying to do is to is to position the navcanvas inside a wxpanel but not maximized (I want to define where and how big it is). But when I run it, it doesn't become the size I want it to be (although it is positioned in the correct place).
Am I missing something here?
Thanks
Astan
import wx
import numpy as N
from wx.lib.floatcanvas import NavCanvas, FloatCanvas, Resources
import wx.html as html
######MAIN WINDOW##########
class mainWindow(wx.Frame):
def __init__(self,parent):
wx.Frame.__init__(self,parent,-1,"FrameCanvas",size=(1050,950),pos=(8,8))
self.wxNoteBook1 = wx.Notebook(self,wx.NewId(),(0,0)) self.Center()
wxNoteBookPage = wx.Panel(self.wxNoteBook1,wx.NewId())
self.chkUndone = wx.CheckBox(wxNoteBookPage,wx.NewId(),"Change Mode",(40,40))
wx.EVT_CHECKBOX(wxNoteBookPage,self.chkUndone.GetId(),self.OnUpdateSettings)
self.htmlGraph = html.HtmlWindow(wxNoteBookPage,wx.NewId(),(4,387),(1030,533),style=html.HW_SCROLLBAR_NEVER|html.HW_NO_SELECTION,name="htmlGraph")
self.points = [(0,-1),(1,-1),(2,3),(3,3),(4,3),(5,-1),(6,1)]
self.mother = wx.Panel(wxNoteBookPage,wx.NewId(),(4,387),(1030,533),style=wx.MAXIMIZE_BOX
wx.RESIZE_BORDER,name="mother")
self.navCanvas = NavCanvas.NavCanvas(self.mother,size=(1030,533))
self.mother.Hide()
self.mother.Disable()
self.wxNoteBook1.AddPage(wxNoteBookPage,"JoBo",True)
self.navCanvas.Canvas.InitAll()
for point in self.points:
self.navCanvas.Canvas.AddPoint(point)
pos = 0
for p in range(0,len(self.points)-1):
xy = (self.points[pos],self.points[pos+1])
self.navCanvas.Canvas.AddLine(xy)
pos+=1
self.navCanvas.Canvas.ZoomToBB()
def OnUpdateSettings(self,event):
if self.chkUndone.GetValue():
self.htmlGraph.Hide()
self.htmlGraph.Disable()
self.mother.Enable()
self.mother.Show() else:
self.htmlGraph.Enable()
self.htmlGraph.Show()
self.mother.Hide()
self.mother.Disable()
#######MAIN APP#######
class App(wx.App):
def OnInit(self):
frame=mainWindow(None)
self.SetTopWindow(frame)
frame.Show()
return True
if __name__=="__main__":
app=App(0)
app.MainLoop()
···
--
"Formulations of number theory: Complete, Consistent, Non-trivial. Choose two." -David Morgan-Mar
Animal Logic
Please think of the environment before printing this email.
This email and any attachments may be confidential and/or privileged. If you are not the intended recipient of this email, you must not disclose or use the information contained in it. Please notify the sender immediately and delete this document if you have received it in error. We do not guarantee this email is error or virus free.