Sorry for a bit of a slow reply -- busy week!

Lansadik wrote:
Hello, I am trying to import the floatcanvas in a window, and I want to
let the floatcanvas resize automatialy after changing the size of the
window, could someone please tell me how to do it? Because I will import
the
window in another splitter window.

This is a wx issue, not a FloatCanvas specific one.

If you put a Window on a parent you need to tell wx how to lay it out. Usually by using a sizer.

The only exception is a single Window on Frame -- then wx defaults to having it fill the Frame.

I also changed the wx.Window to a wx.Panel, as wx.Panel is designed to put other Windows on it, it has a few features that help.

Enclosed is a version that works for me.


-Chris



Thanks!
here is my code(draw.py):
-------------------------------------------------------------------

import wx
from wx.lib.floatcanvas import NavCanvas, FloatCanvas, Resources

class drawWindow(wx.Window):
    def __init__(self, parent, ID,position,size):
        wx.Window.__init__(self, parent, ID, position,size)
NC = NavCanvas.NavCanvas(self, Debug = 0, BackgroundColor =
"yellow")
        self.Canvas = NC.Canvas
    def drawLines(self, event=None):
        wx.GetApp().Yield(True)
        Range = (-10,10)
        Canvas = self.Canvas
Canvas.InitAll() Canvas.MinScale = 14
        Canvas.MaxScale = 500
        Canvas.AddLine([(80,3), (6,500)], LineWidth = 4,LineColor =
"black") Canvas.ZoomToBB()


class SketchFrame(wx.Frame):
    def __init__(self, parent):
        wx.Frame.__init__(self, parent, -1, "Sketch Frame",
                size=(600,400))
self.sketch = drawWindow(self, -1,wx.DefaultPosition,size =
wx.DefaultSize)


if __name__ == '__main__':
    app = wx.PySimpleApp()
    frame = SketchFrame(None)
    frame.Show(True)
    app.MainLoop()


------------------------------------------------------------------------

_______________________________________________
FloatCanvas mailing list
[email protected]
http://mail.mithis.com/cgi-bin/mailman/listinfo/floatcanvas


--
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]

Attachment: draw.py
Description: application/python

_______________________________________________
FloatCanvas mailing list
[email protected]
http://mail.mithis.com/cgi-bin/mailman/listinfo/floatcanvas

Reply via email to