mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-04 11:00:07 +01:00
Add the FloatCanvas demo modules
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@73860 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
43
samples/floatcanvas/NonGUI.py
Executable file
43
samples/floatcanvas/NonGUI.py
Executable file
@@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
"""
|
||||
Demo of a FloatCanvas App that will create an image, without
|
||||
actually showing anything on screen. It seems to work, but you do need
|
||||
to have an X-server running on *nix for this to work.
|
||||
|
||||
Note: you need to specify the size in the FloatCanvas Constructor.
|
||||
|
||||
hmm -- I wonder if you'd even need the frame?
|
||||
|
||||
"""
|
||||
|
||||
import wx
|
||||
|
||||
## import the installed version
|
||||
from wx.lib.floatcanvas import FloatCanvas
|
||||
|
||||
## import a local version
|
||||
#import sys
|
||||
#sys.path.append("../")
|
||||
#from floatcanvas import NavCanvas, FloatCanvas
|
||||
|
||||
app = wx.PySimpleApp()
|
||||
|
||||
f = wx.Frame(None)
|
||||
Canvas = FloatCanvas.FloatCanvas(f,
|
||||
BackgroundColor = "Cyan",
|
||||
size=(500,500)
|
||||
)
|
||||
|
||||
|
||||
Canvas.AddRectangle((0,0), (16,20))
|
||||
Canvas.AddRectangle((1,1), (6,8.5))
|
||||
Canvas.AddRectangle((9,1), (6,8.5))
|
||||
Canvas.AddRectangle((9,10.5), (6,8.5))
|
||||
Canvas.AddRectangle((1,10.5), (6,8.5))
|
||||
Canvas.ZoomToBB()
|
||||
|
||||
|
||||
print "Saving the image:", "junk.png"
|
||||
Canvas.SaveAsImage("junk.png")
|
||||
|
||||
Reference in New Issue
Block a user