Images can now be embedded in Python source files.
Added tools to do the embedding. Added Constructors/methods where needed. Updated the demo to use mostly embedded images. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9693 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
@@ -3,6 +3,7 @@ from wxPython.wx import *
|
||||
from wxPython.lib.buttons import wxGenButton, wxGenBitmapButton, \
|
||||
wxGenToggleButton, wxGenBitmapToggleButton
|
||||
|
||||
import images
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -34,18 +35,18 @@ class TestPanel(wxPanel):
|
||||
#b.SetUseFocusIndicator(false)
|
||||
b.SetToolTipString("This is a BIG button...")
|
||||
|
||||
bmp = wxBitmap('bitmaps/test2.bmp', wxBITMAP_TYPE_BMP)
|
||||
bmp = images.getTest2Bitmap()
|
||||
b = wxGenBitmapButton(self, -1, bmp, (10, 130))
|
||||
EVT_BUTTON(self, b.GetId(), self.OnButton)
|
||||
|
||||
|
||||
b = wxGenBitmapButton(self, -1, None, (140, 130))
|
||||
EVT_BUTTON(self, b.GetId(), self.OnButton)
|
||||
bmp = wxBitmap('bitmaps/lb1.bmp', wxBITMAP_TYPE_BMP)
|
||||
bmp = images.getBulb1Bitmap()
|
||||
mask = wxMaskColour(bmp, wxBLUE)
|
||||
bmp.SetMask(mask)
|
||||
b.SetBitmapLabel(bmp)
|
||||
bmp = wxBitmap('bitmaps/lb2.bmp', wxBITMAP_TYPE_BMP)
|
||||
bmp = images.getBulb2Bitmap()
|
||||
mask = wxMaskColour(bmp, wxBLUE)
|
||||
bmp.SetMask(mask)
|
||||
b.SetBitmapSelected(bmp)
|
||||
@@ -57,11 +58,11 @@ class TestPanel(wxPanel):
|
||||
|
||||
b = wxGenBitmapToggleButton(self, -1, None, (140, 230))
|
||||
EVT_BUTTON(self, b.GetId(), self.OnToggleButton)
|
||||
bmp = wxBitmap('bitmaps/lb1.bmp', wxBITMAP_TYPE_BMP)
|
||||
bmp = images.getBulb1Bitmap()
|
||||
mask = wxMaskColour(bmp, wxBLUE)
|
||||
bmp.SetMask(mask)
|
||||
b.SetBitmapLabel(bmp)
|
||||
bmp = wxBitmap('bitmaps/lb2.bmp', wxBITMAP_TYPE_BMP)
|
||||
bmp = images.getBulb2Bitmap()
|
||||
mask = wxMaskColour(bmp, wxBLUE)
|
||||
bmp.SetMask(mask)
|
||||
b.SetBitmapSelected(bmp)
|
||||
|
@@ -211,6 +211,7 @@ class GridEditorTest(wxGrid):
|
||||
self.SetColSize(1, 150)
|
||||
self.SetColSize(2, 150)
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
class TestFrame(wxFrame):
|
||||
|
@@ -16,6 +16,8 @@ from wxPython.wx import *
|
||||
from wxPython.lib.splashscreen import SplashScreen
|
||||
from wxPython.html import wxHtmlWindow
|
||||
|
||||
import images
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -75,10 +77,10 @@ class wxPythonDemo(wxFrame):
|
||||
self.cwd = os.getcwd()
|
||||
self.curOverview = ""
|
||||
|
||||
if wxPlatform == '__WXMSW__':
|
||||
icon = wxIcon('bitmaps/mondrian.ico', wxBITMAP_TYPE_ICO)
|
||||
self.SetIcon(icon)
|
||||
icon = wxIconFromXPMData(images.getMondrianData())
|
||||
self.SetIcon(icon)
|
||||
|
||||
if wxPlatform == '__WXMSW__':
|
||||
# setup a taskbar icon, and catch some events from it
|
||||
self.tbicon = wxTaskBarIcon()
|
||||
self.tbicon.SetIcon(icon, "wxPython Demo")
|
||||
|
Before Width: | Height: | Size: 545 B After Width: | Height: | Size: 545 B |
Before Width: | Height: | Size: 990 B After Width: | Height: | Size: 990 B |
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 630 B After Width: | Height: | Size: 630 B |
Before Width: | Height: | Size: 630 B After Width: | Height: | Size: 630 B |
Before Width: | Height: | Size: 630 B After Width: | Height: | Size: 630 B |
Before Width: | Height: | Size: 630 B After Width: | Height: | Size: 630 B |
Before Width: | Height: | Size: 630 B After Width: | Height: | Size: 630 B |
Before Width: | Height: | Size: 630 B After Width: | Height: | Size: 630 B |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 238 B After Width: | Height: | Size: 238 B |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 766 B After Width: | Height: | Size: 766 B |
Before Width: | Height: | Size: 238 B After Width: | Height: | Size: 238 B |
Before Width: | Height: | Size: 238 B After Width: | Height: | Size: 238 B |
Before Width: | Height: | Size: 238 B After Width: | Height: | Size: 238 B |
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 246 B After Width: | Height: | Size: 246 B |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 238 B After Width: | Height: | Size: 238 B |
Before Width: | Height: | Size: 238 B After Width: | Height: | Size: 238 B |
56
wxPython/demo/encode_bitmaps.py
Normal file
@@ -0,0 +1,56 @@
|
||||
#!/usr/bin/env python
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
"""
|
||||
This is a way to save the startup time when running img2py on lots of
|
||||
files...
|
||||
"""
|
||||
|
||||
import sys, string
|
||||
sys.path.insert(0, "../tools")
|
||||
|
||||
import img2py
|
||||
|
||||
|
||||
command_lines = [
|
||||
" -n Mondrian bmp_source/mondrian.ico images.py",
|
||||
|
||||
"-a -n _10s_ bmp_source/10s.gif images.py",
|
||||
"-a -n _01c_ bmp_source/01c.gif images.py",
|
||||
"-a -n _12h_ bmp_source/12h.gif images.py",
|
||||
"-a -n _13d_ bmp_source/13d.gif images.py",
|
||||
"-a -n Background bmp_source/backgrnd.png images.py",
|
||||
"-a -n TestStar -m #FFFFFF bmp_source/teststar.png images.py",
|
||||
"-a -n TestStar2 bmp_source/teststar.png images.py",
|
||||
"-a -n TestMask bmp_source/testmask.bmp images.py",
|
||||
|
||||
"-a -n Test2 bmp_source/test2.bmp images.py",
|
||||
"-a -n Robin bmp_source/robin.jpg images.py",
|
||||
|
||||
"-a -n Bulb1 bmp_source/lb1.bmp images.py",
|
||||
"-a -n Bulb2 bmp_source/lb2.bmp images.py",
|
||||
|
||||
"-a -n Calendar bmp_source/Calend.bmp images.py",
|
||||
"-a -n DbDec bmp_source/DbDec.bmp images.py",
|
||||
"-a -n Dec bmp_source/Dec.bmp images.py",
|
||||
"-a -n Pt bmp_source/Pt.bmp images.py",
|
||||
"-a -n DbInc bmp_source/DbInc.bmp images.py",
|
||||
"-a -n Inc bmp_source/Inc.bmp images.py",
|
||||
|
||||
"-a -n New bmp_source/new.bmp images.py",
|
||||
"-a -n Open bmp_source/open.bmp images.py",
|
||||
"-a -n Copy bmp_source/copy.bmp images.py",
|
||||
"-a -n Paste bmp_source/paste.bmp images.py",
|
||||
"-a -n Tog1 bmp_source/tog1.bmp images.py",
|
||||
"-a -n Tog2 bmp_source/tog2.bmp images.py",
|
||||
|
||||
"-a -n Smiles bmp_source/smiles.bmp images.py",
|
||||
|
||||
#"-a -n bmp_source/ images.py",
|
||||
]
|
||||
|
||||
|
||||
for line in command_lines:
|
||||
args = string.split(line)
|
||||
img2py.main(args)
|
||||
|
5183
wxPython/demo/images.py
Normal file
@@ -24,7 +24,7 @@ beautifully documented...
|
||||
"""
|
||||
|
||||
from wxPython import wx
|
||||
import string # Don't use it, but it's fun expanding :-)
|
||||
import sys, string # Don't use it, but it's fun expanding :-)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
@@ -161,7 +161,8 @@ def runTest(frame, nb, log):
|
||||
This method is used by the wxPython Demo Framework for integrating
|
||||
this demo with the rest.
|
||||
"""
|
||||
thisModule = __import__(__name__, globals())
|
||||
#thisModule = __import__(__name__, globals())
|
||||
thisModule = sys.modules[__name__]
|
||||
win = wx.wxFrame(frame, -1, "PyTreeItemData Test")
|
||||
split = wx.wxSplitterWindow(win, -1)
|
||||
tree = pyTree(split, -1, thisModule)
|
||||
|
@@ -1,6 +1,8 @@
|
||||
|
||||
from wxPython.wx import *
|
||||
|
||||
import images
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
class TestPanel(wxPanel):
|
||||
@@ -19,8 +21,7 @@ class TestPanel(wxPanel):
|
||||
|
||||
b.SetToolTipString("This is a Hello button...")
|
||||
|
||||
bmp = wxBitmap('bitmaps/test2.bmp', wxBITMAP_TYPE_BMP)
|
||||
|
||||
bmp = images.getTest2Bitmap()
|
||||
mask = wxMaskColour(bmp, wxBLUE)
|
||||
bmp.SetMask(mask)
|
||||
|
||||
|
@@ -4,7 +4,7 @@
|
||||
#
|
||||
# Author: Lorne White (email: lwhite1@planet.eon.net)
|
||||
#
|
||||
# Version 0.9
|
||||
# Version 0.9
|
||||
# Date: Feb 26, 2001
|
||||
# Licence: wxWindows license
|
||||
#----------------------------------------------------------------------------
|
||||
@@ -12,8 +12,8 @@
|
||||
from wxPython.wx import *
|
||||
from wxPython.lib.calendar import wxCalendar, Month, PrtCalDraw, CalenDlg
|
||||
|
||||
import images
|
||||
import os
|
||||
dir_path = os.getcwd()
|
||||
|
||||
|
||||
# highlighted days in month
|
||||
@@ -107,7 +107,7 @@ class TestPanel(wxPanel):
|
||||
wxStaticText(self, -1, "Test Calendar Dialog", wxPoint(350, 50), wxSize(150, -1))
|
||||
|
||||
mID = NewId()
|
||||
bmp = wxBitmap('bitmaps/Calend.bmp', wxBITMAP_TYPE_BMP)
|
||||
bmp = images.getCalendarBitmap()
|
||||
self.but = wxBitmapButton(self, mID, bmp, wxPoint(380, 80))#, wxSize(30, 30))
|
||||
EVT_BUTTON(self, mID, self.TestDlg)
|
||||
|
||||
@@ -116,14 +116,12 @@ class TestPanel(wxPanel):
|
||||
wxStaticText(self, -1, "Test Calendar Window", wxPoint(350, 150), wxSize(150, -1))
|
||||
|
||||
mID = NewId()
|
||||
bmp = wxBitmap('bitmaps/Calend.bmp', wxBITMAP_TYPE_BMP)
|
||||
self.but = wxBitmapButton(self, mID, bmp, wxPoint(380, 180))#, wxSize(30, 30))
|
||||
EVT_BUTTON(self, mID, self.TestFrame)
|
||||
|
||||
wxStaticText(self, -1, "Test Calendar Print", wxPoint(350, 250), wxSize(150, -1))
|
||||
|
||||
mID = NewId()
|
||||
bmp = wxBitmap('bitmaps/Calend.bmp', wxBITMAP_TYPE_BMP)
|
||||
self.but = wxBitmapButton(self, mID, bmp, wxPoint(380, 280))#, wxSize(30, 30))
|
||||
EVT_BUTTON(self, mID, self.OnPreview)
|
||||
|
||||
@@ -316,26 +314,24 @@ class CalendFrame(wxFrame):
|
||||
def MakeToolMenu(self):
|
||||
tb = self.CreateToolBar(wxTB_HORIZONTAL|wxNO_BORDER)
|
||||
|
||||
bmp_path = 'bitmaps/'
|
||||
|
||||
mID = NewId()
|
||||
SetToolPath(self, tb, mID, bmp_path + 'DbDec.bmp', 'Dec Year')
|
||||
SetToolPath(self, tb, mID, images.getDbDecBitmap(), 'Dec Year')
|
||||
EVT_TOOL(self, mID, self.OnDecYear)
|
||||
|
||||
mID = NewId()
|
||||
SetToolPath(self, tb, mID, bmp_path + 'Dec.bmp', 'Dec Month')
|
||||
SetToolPath(self, tb, mID, images.getDecBitmap(), 'Dec Month')
|
||||
EVT_TOOL(self, mID, self.OnDecMonth)
|
||||
|
||||
mID = NewId()
|
||||
SetToolPath(self, tb, mID, bmp_path + 'Pt.bmp', 'Current Month')
|
||||
SetToolPath(self, tb, mID, images.getPtBitmap(), 'Current Month')
|
||||
EVT_TOOL(self, mID, self.OnCurrent)
|
||||
|
||||
mID = NewId()
|
||||
SetToolPath(self, tb, mID, bmp_path + 'Inc.bmp', 'Inc Month')
|
||||
SetToolPath(self, tb, mID, images.getIncBitmap(), 'Inc Month')
|
||||
EVT_TOOL(self, mID, self.OnIncMonth)
|
||||
|
||||
mID = NewId()
|
||||
SetToolPath(self, tb, mID, bmp_path + 'DbInc.bmp', 'Inc Year')
|
||||
SetToolPath(self, tb, mID, images.getDbIncBitmap(), 'Inc Year')
|
||||
EVT_TOOL(self, mID, self.OnIncYear)
|
||||
|
||||
tb.Realize()
|
||||
@@ -518,9 +514,7 @@ class PrintCalend:
|
||||
self.ptheight = height
|
||||
|
||||
def SetToolPath(self, tb, id, bmp, title):
|
||||
global dir_path
|
||||
tb.AddSimpleTool(id, wxBitmap(os.path.join(dir_path, bmp), wxBITMAP_TYPE_BMP),
|
||||
title, title)
|
||||
tb.AddSimpleTool(id, bmp, title, title)
|
||||
|
||||
class SetPrintout(wxPrintout):
|
||||
def __init__(self, canvas):
|
||||
|
@@ -1,6 +1,8 @@
|
||||
|
||||
from wxPython.wx import *
|
||||
|
||||
import images
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
class DragShape:
|
||||
@@ -47,14 +49,14 @@ class DragCanvas(wxScrolledWindow):
|
||||
self.dragShape = None
|
||||
|
||||
self.SetCursor(wxStockCursor(wxCURSOR_ARROW))
|
||||
self.bg_bmp = wxBitmap('bitmaps/backgrnd.png', wxBITMAP_TYPE_PNG)
|
||||
self.bg_bmp = images.getBackgroundBitmap()
|
||||
|
||||
|
||||
# Make a shape from an image and mask. This one will demo
|
||||
# dragging outside the window
|
||||
bmp = wxBitmap('bitmaps/test_image.png', wxBITMAP_TYPE_PNG)
|
||||
mask = wxMaskColour(bmp, wxWHITE)
|
||||
bmp.SetMask(mask)
|
||||
bmp = images.getTestStarBitmap()
|
||||
#mask = wxMaskColour(bmp, wxWHITE)
|
||||
#bmp.SetMask(mask)
|
||||
shape = DragShape(bmp)
|
||||
shape.pos = wxPoint(5, 5)
|
||||
shape.fullscreen = true
|
||||
@@ -84,8 +86,9 @@ class DragCanvas(wxScrolledWindow):
|
||||
|
||||
# Make some shapes from some playing card images.
|
||||
x = 200
|
||||
for card in ['01c.gif', '10s.gif', '12h.gif', '13d.gif']:
|
||||
bmp = wxBitmap('bitmaps/'+card, wxBITMAP_TYPE_GIF)
|
||||
for card in ['_01c_', '_12h_', '_13d_', '_10s_']:
|
||||
bmpFunc = getattr(images, "get%sBitmap" % card)
|
||||
bmp = bmpFunc()
|
||||
shape = DragShape(bmp)
|
||||
shape.pos = wxPoint(x, 5)
|
||||
self.shapes.append(shape)
|
||||
|
@@ -1,6 +1,9 @@
|
||||
from wxPython.wx import *
|
||||
from wxPython.lib.floatbar import *
|
||||
|
||||
import images
|
||||
|
||||
|
||||
class TestFloatBar(wxFrame):
|
||||
def __init__(self, parent, log):
|
||||
wxFrame.__init__(self, parent, -1, 'Test ToolBar',
|
||||
@@ -17,32 +20,28 @@ class TestFloatBar(wxFrame):
|
||||
tb.SetFloatable(1)
|
||||
tb.SetTitle("Floating!")
|
||||
self.CreateStatusBar()
|
||||
tb.AddSimpleTool(10, wxBitmap('bitmaps/new.bmp', wxBITMAP_TYPE_BMP),
|
||||
"New", "Long help for 'New'")
|
||||
|
||||
tb.AddSimpleTool(10, images.getNewBitmap(), "New", "Long help for 'New'")
|
||||
EVT_TOOL(self, 10, self.OnToolClick)
|
||||
EVT_TOOL_RCLICKED(self, 10, self.OnToolRClick)
|
||||
|
||||
tb.AddSimpleTool(20, wxBitmap('bitmaps/open.bmp', wxBITMAP_TYPE_BMP),
|
||||
"Open")
|
||||
tb.AddSimpleTool(20, images.getOpenBitmap(), "Open")
|
||||
EVT_TOOL(self, 20, self.OnToolClick)
|
||||
EVT_TOOL_RCLICKED(self, 20, self.OnToolRClick)
|
||||
|
||||
tb.AddSeparator()
|
||||
tb.AddSimpleTool(30, wxBitmap('bitmaps/copy.bmp', wxBITMAP_TYPE_BMP),
|
||||
"Copy")
|
||||
tb.AddSimpleTool(30, images.getCopyBitmap(), "Copy")
|
||||
EVT_TOOL(self, 30, self.OnToolClick)
|
||||
EVT_TOOL_RCLICKED(self, 30, self.OnToolRClick)
|
||||
|
||||
tb.AddSimpleTool(40, wxBitmap('bitmaps/paste.bmp', wxBITMAP_TYPE_BMP),
|
||||
"Paste")
|
||||
tb.AddSimpleTool(40, images.getPasteBitmap(), "Paste")
|
||||
EVT_TOOL(self, 40, self.OnToolClick)
|
||||
EVT_TOOL_RCLICKED(self, 40, self.OnToolRClick)
|
||||
|
||||
tb.AddSeparator()
|
||||
|
||||
|
||||
tb.AddTool(60, wxBitmap('bitmaps/tog1.bmp', wxBITMAP_TYPE_BMP),
|
||||
wxBitmap('bitmaps/tog2.bmp', wxBITMAP_TYPE_BMP),
|
||||
tb.AddTool(60, images.getTog1Bitmap(), images.getTog2Bitmap(),
|
||||
shortHelpString="Toggle with 2 bitmaps", isToggle=true)
|
||||
EVT_TOOL(self, 60, self.OnToolClick)
|
||||
EVT_TOOL_RCLICKED(self, 60, self.OnToolRClick)
|
||||
|
@@ -57,6 +57,7 @@ musicdata = {
|
||||
39: ("Yes", "Rhythm Of Love", "Rock"),
|
||||
}
|
||||
|
||||
import images
|
||||
|
||||
class TestListCtrlPanel(wxPanel):
|
||||
def __init__(self, parent, log):
|
||||
@@ -66,7 +67,7 @@ class TestListCtrlPanel(wxPanel):
|
||||
tID = wxNewId()
|
||||
|
||||
self.il = wxImageList(16, 16)
|
||||
bmp = wxBitmap('bitmaps/smiles.bmp', wxBITMAP_TYPE_BMP)
|
||||
bmp = images.getSmilesBitmap()
|
||||
idx1 = self.il.AddWithColourMask(bmp, wxWHITE)
|
||||
|
||||
self.list = wxListCtrl(self, tID,
|
||||
|
@@ -26,19 +26,21 @@ logicList = [
|
||||
('wxXOR', wxXOR),
|
||||
]
|
||||
|
||||
import images
|
||||
|
||||
class TestMaskWindow(wxScrolledWindow):
|
||||
def __init__(self, parent):
|
||||
wxScrolledWindow.__init__(self, parent, -1)
|
||||
self.SetBackgroundColour(wxColour(0,128,0))
|
||||
|
||||
# A reference bitmap that we won't mask
|
||||
self.bmp_nomask = wxBitmap('bitmaps/test_image.png', wxBITMAP_TYPE_PNG)
|
||||
self.bmp_nomask = images.getTestStar2Bitmap()
|
||||
|
||||
# One that we will
|
||||
self.bmp_withmask = wxBitmap('bitmaps/test_image.png', wxBITMAP_TYPE_PNG)
|
||||
self.bmp_withmask = images.getTestStar2Bitmap()
|
||||
|
||||
# this mask comes from a monochrome bitmap
|
||||
self.bmp_themask = wxBitmap('bitmaps/test_mask.bmp', wxBITMAP_TYPE_BMP)
|
||||
self.bmp_themask = images.getTestMaskBitmap()
|
||||
self.bmp_themask.SetDepth(1)
|
||||
mask = wxMask(self.bmp_themask)
|
||||
|
||||
@@ -47,7 +49,7 @@ class TestMaskWindow(wxScrolledWindow):
|
||||
|
||||
# Now we'll create a mask in a bit of an easier way, by picking a
|
||||
# colour in the image that is to be the transparent colour.
|
||||
self.bmp_withcolourmask = wxBitmap('bitmaps/test_image.png', wxBITMAP_TYPE_PNG)
|
||||
self.bmp_withcolourmask = images.getTestStar2Bitmap()
|
||||
mask = wxMaskColour(self.bmp_withcolourmask, wxWHITE)
|
||||
self.bmp_withcolourmask.SetMask(mask)
|
||||
|
||||
|
@@ -2,6 +2,8 @@
|
||||
from wxPython.wx import *
|
||||
from wxPython.ogl import *
|
||||
|
||||
import images
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# This creates some pens and brushes that the OGL library uses.
|
||||
|
||||
@@ -41,40 +43,6 @@ class RoundedRectangleShape(wxRectangleShape):
|
||||
self.SetCornerRadius(-0.3)
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
## class LabeledBitmapShape(wxBitmapShape):
|
||||
## def __init__(self, bmp, text):
|
||||
## wxBitmapShape.__init__(self)
|
||||
## self.SetBitmap(bmp)
|
||||
## self.region = r = wxShapeRegion()
|
||||
## r.SetPosition(0, 0) #bmp.GetHeight())
|
||||
## r.SetSize(bmp.GetWidth(), bmp.GetHeight())
|
||||
## r.SetText(text)
|
||||
## self.AddRegion(r)
|
||||
|
||||
## def OnMovePost(self, dc, x, y, old_x, old_y, display):
|
||||
## self.region.SetPosition(x, y)
|
||||
## self.base_OnMovePost(dc, x, y, old_x, old_y, display)
|
||||
|
||||
|
||||
## class LabeledBitmapShape(wxCompositeShape):
|
||||
## def __init__(self, canvas, bmp, text):
|
||||
## wxCompositeShape.__init__(self)
|
||||
## self.bs = wxBitmapShape()
|
||||
## self.bs.SetBitmap(bmp)
|
||||
## self.ts = wxTextShape()
|
||||
## self.ts.AddText(text)
|
||||
|
||||
## self.AddChild(self.bs)
|
||||
## self.AddChild(self.ts, self.bs)
|
||||
|
||||
## self.AddConstrainedShapes(gyCONSTRAINT_CENTRED_VERTICALLY, self, [self.bs, self.ts])
|
||||
## self.AddSimpleConstraint(gyCONSTRAINT_BELOW, self.bs, self.ts)
|
||||
## self.AddSimpleConstraint(gyCONSTRAINT_ALIGNED_TOP, self, self.bs)
|
||||
## self.AddSimpleConstraint(gyCONSTRAINT_ALIGNED_BOTTOM, self, self.ts)
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
class MyEvtHandler(wxShapeEvtHandler):
|
||||
@@ -168,19 +136,9 @@ class TestWindow(wxShapeCanvas):
|
||||
self.MyAddShape(DiamondShape(90, 90), 345, 235, wxPen(wxBLUE, 3, wxDOT), wxRED_BRUSH, "Polygon")
|
||||
self.MyAddShape(RoundedRectangleShape(95,70), 140, 255, wxPen(wxRED, 1), rRectBrush, "Rounded Rect")
|
||||
|
||||
bmp = wxBitmap('bitmaps/test2.bmp', wxBITMAP_TYPE_BMP)
|
||||
bmp = images.getTest2Bitmap()
|
||||
mask = wxMaskColour(bmp, wxBLUE)
|
||||
bmp.SetMask(mask)
|
||||
## s = LabeledBitmapShape(self, bmp, "Hello")
|
||||
## self.MyAddShape(s, 225, 150, None, None, None)
|
||||
## print s.Recompute()
|
||||
## s.CalculateSize()
|
||||
## print s.GetX(), s.GetY()
|
||||
## s.SetSize(225)
|
||||
## s.SetY(150)
|
||||
## s.SetSize(80, 80)
|
||||
## print s.GetX(), s.GetY()
|
||||
## #print s.GetSize()
|
||||
|
||||
s = wxBitmapShape()
|
||||
s.SetBitmap(bmp)
|
||||
|
@@ -1,6 +1,8 @@
|
||||
|
||||
from wxPython.wx import *
|
||||
|
||||
import images
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
class MyCanvas(wxScrolledWindow):
|
||||
@@ -20,7 +22,7 @@ class MyCanvas(wxScrolledWindow):
|
||||
|
||||
|
||||
self.SetCursor(wxStockCursor(wxCURSOR_PENCIL))
|
||||
bmp = wxBitmap('bitmaps/test2.bmp', wxBITMAP_TYPE_BMP)
|
||||
bmp = images.getTest2Bitmap()
|
||||
mask = wxMaskColour(bmp, wxBLUE)
|
||||
bmp.SetMask(mask)
|
||||
self.bmp = bmp
|
||||
|
@@ -2,6 +2,7 @@
|
||||
from wxPython.wx import *
|
||||
|
||||
import string
|
||||
import images
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
@@ -13,13 +14,13 @@ class TestPanel(wxPanel):
|
||||
|
||||
wxStaticText(self, -1, "This is a wxStaticBitmap.", wxPoint(45, 15))
|
||||
|
||||
bmp = wxBitmap('bitmaps/test2.bmp', wxBITMAP_TYPE_BMP)
|
||||
bmp = images.getTest2Bitmap()
|
||||
mask = wxMaskColour(bmp, wxBLUE)
|
||||
bmp.SetMask(mask)
|
||||
wxStaticBitmap(self, -1, bmp, wxPoint(80, 50),
|
||||
wxSize(bmp.GetWidth(), bmp.GetHeight()))
|
||||
|
||||
bmp = wxBitmap('bitmaps/robin.jpg', wxBITMAP_TYPE_JPEG)
|
||||
bmp = images.getRobinBitmap()
|
||||
wxStaticBitmap(self, -1, bmp, (80, 150))
|
||||
|
||||
wxStaticText(self, -1, "Hey, if Ousterhout can do it, so can I.",
|
||||
|
@@ -1,6 +1,8 @@
|
||||
|
||||
from wxPython.wx import *
|
||||
|
||||
import images
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
class TestToolBar(wxFrame):
|
||||
@@ -20,31 +22,30 @@ class TestToolBar(wxFrame):
|
||||
|
||||
self.CreateStatusBar()
|
||||
|
||||
tb.AddSimpleTool(10, wxBitmap('bitmaps/new.bmp', wxBITMAP_TYPE_BMP),
|
||||
"New", "Long help for 'New'")
|
||||
tb.AddSimpleTool(10, images.getNewBitmap(), "New", "Long help for 'New'")
|
||||
EVT_TOOL(self, 10, self.OnToolClick)
|
||||
EVT_TOOL_RCLICKED(self, 10, self.OnToolRClick)
|
||||
|
||||
tb.AddSimpleTool(20, wxBitmap('bitmaps/open.bmp', wxBITMAP_TYPE_BMP),
|
||||
"Open", "Long help for 'Open'")
|
||||
tb.AddSimpleTool(20, images.getOpenBitmap(), "Open")
|
||||
EVT_TOOL(self, 20, self.OnToolClick)
|
||||
EVT_TOOL_RCLICKED(self, 20, self.OnToolRClick)
|
||||
|
||||
tb.AddSeparator()
|
||||
tb.AddSimpleTool(30, wxBitmap('bitmaps/copy.bmp', wxBITMAP_TYPE_BMP),
|
||||
"Copy", "Long help for 'Copy'")
|
||||
tb.AddSimpleTool(30, images.getCopyBitmap(), "Copy")
|
||||
EVT_TOOL(self, 30, self.OnToolClick)
|
||||
EVT_TOOL_RCLICKED(self, 30, self.OnToolRClick)
|
||||
|
||||
tb.AddSimpleTool(40, wxBitmap('bitmaps/paste.bmp', wxBITMAP_TYPE_BMP),
|
||||
"Paste", "Long help for 'Paste'")
|
||||
tb.AddSimpleTool(40, images.getPasteBitmap(), "Paste")
|
||||
EVT_TOOL(self, 40, self.OnToolClick)
|
||||
EVT_TOOL_RCLICKED(self, 40, self.OnToolRClick)
|
||||
|
||||
tb.AddSeparator()
|
||||
|
||||
tool = tb.AddTool(50, wxBitmap('bitmaps/tog1.bmp', wxBITMAP_TYPE_BMP),
|
||||
tool = tb.AddTool(50, images.getTog1Bitmap(),
|
||||
shortHelpString="Toggle this", isToggle=true)
|
||||
EVT_TOOL(self, 50, self.OnToolClick)
|
||||
|
||||
tb.AddTool(60, wxBitmap('bitmaps/tog1.bmp', wxBITMAP_TYPE_BMP),
|
||||
wxBitmap('bitmaps/tog2.bmp', wxBITMAP_TYPE_BMP),
|
||||
tb.AddTool(60, images.getTog1Bitmap(), images.getTog2Bitmap(),
|
||||
shortHelpString="Toggle with 2 bitmaps", isToggle=true)
|
||||
EVT_TOOL(self, 60, self.OnToolClick)
|
||||
|
||||
|
@@ -31,12 +31,13 @@ class TestTreeCtrlPanel(wxPanel):
|
||||
self.tree = MyTreeCtrl(self, tID, wxDefaultPosition, wxDefaultSize,
|
||||
wxTR_HAS_BUTTONS | wxTR_EDIT_LABELS)# | wxTR_MULTIPLE)
|
||||
|
||||
#import images
|
||||
#il = wxImageList(16, 16)
|
||||
#idx1 = il.Add(wxBitmap('bitmaps/smiles.bmp', wxBITMAP_TYPE_BMP))
|
||||
#idx2 = il.Add(wxBitmap('bitmaps/open.bmp', wxBITMAP_TYPE_BMP))
|
||||
#idx3 = il.Add(wxBitmap('bitmaps/new.bmp', wxBITMAP_TYPE_BMP))
|
||||
#idx4 = il.Add(wxBitmap('bitmaps/copy.bmp', wxBITMAP_TYPE_BMP))
|
||||
#idx5 = il.Add(wxBitmap('bitmaps/paste.bmp', wxBITMAP_TYPE_BMP))
|
||||
#idx1 = il.Add(images.getSmilesBitmap())
|
||||
#idx2 = il.Add(images.getOpenBitmap())
|
||||
#idx3 = il.Add(images.getNewBitmap())
|
||||
#idx4 = il.Add(images.getCopyBitmap())
|
||||
#idx5 = il.Add(images.getPasteBitmap())
|
||||
|
||||
#self.tree.SetImageList(il)
|
||||
#self.il = il
|
||||
|