Can Baran wrote:
I was not sure whether my email to the mail list of Float Canvas went.

no, it didn't seem to. You do need to be subscribed to the list to post to it. I haven't replied 'till now, as I've been on vacation. I've cc'd this to the list, as others may have comments, and I like these to get into the archives.

I would like to create the following hierarchy:
-Frame
-SplitterWindow
-NavCanvas
-Panel

This should work. I just edited your code, and got it to work. See the enclosed sample. The key was this:

NavCanvas is a wx.Panel that has the toolbar and a FloatCanvas on it. So, you need to put the NavCanvas itself into the splitter, and then reference the NavCanvas' Canvas separately.

I also put the call to "ZoomToBB" in a wx.CallAfter, so that it would get called after the whole thing was set up and sized.

-Chris







--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

[EMAIL PROTECTED]
#!/usr/bin/env python

import wx
from wx.lib.floatcanvas import NavCanvas

class MyFrame(wx.Frame):
    def __init__(self, *args, **kwargs):
        wx.Frame.__init__(self, *args, **kwargs)

        #Adding the SplitterWindow
        splitter = wx.SplitterWindow(self, style=wx.SP_LIVE_UPDATE)

        # add the Panels
        panel1 = wx.Panel(splitter, size = (300,300))
        panel1.SetBackgroundColour(wx.LIGHT_GREY)

        #panel2 = wx.Panel(splitter, size=(300,300))
        #panel2.SetBackgroundColour(wx.RED)

        panel2 = NavCanvas.NavCanvas(splitter,
                                     ProjectionFun = None,
                                     Debug = 0,
                                     BackgroundColor = "DARK SLATE BLUE",
                                     )
        Canvas = panel2.Canvas
        Point = (15,10)
        Canvas.AddScaledTextBox("A Two Line\nString",
                                      Point,
                                      2,
                                      Color = "Black",
                                      BackgroundColor = None,
                                      LineColor = "Red",
                                      LineStyle = "Solid",
                                      LineWidth = 1,
                                      Width = None,
                                      PadSize = 5,
                                      Family = wx.ROMAN,
                                      Style = wx.NORMAL,
                                      Weight = wx.NORMAL,
                                      Underlined = False,
                                      Position = 'br',
                                      Alignment = "left",
                                      InForeground = False)
        
        wx.CallAfter(Canvas.ZoomToBB)


        sash_Position = 100
        splitter.SplitVertically(panel1, panel2, sash_Position)
        min_Pan_size = 40
        splitter.SetMinimumPaneSize(min_Pan_size)


class MyApp(wx.App):
    def OnInit(self):
        frame = MyFrame(None, title='splitter test', size=(300,400))
        frame.Show(True)
        self.SetTopWindow(frame)
        return True

app = MyApp(0)
app.MainLoop()
_______________________________________________
FloatCanvas mailing list
[email protected]
http://mail.mithis.com/cgi-bin/mailman/listinfo/floatcanvas

Reply via email to