Update demos to work wxWidgets 3.1.6

This commit is contained in:
Scott Talbert
2022-04-28 23:05:02 -04:00
parent 37ba9563b6
commit 58682ecaf4
8 changed files with 64 additions and 54 deletions

View File

@@ -157,18 +157,18 @@ class PyAUIFrame(wx.Frame):
tb1 = wx.ToolBar(self, -1, wx.DefaultPosition, wx.DefaultSize,
wx.TB_FLAT | wx.TB_NODIVIDER)
tb1.SetToolBitmapSize(wx.Size(48,48))
tb1.AddTool(101, "Test", wx.ArtProvider.GetBitmap(wx.ART_ERROR))
tb1.AddTool(101, "Test", wx.ArtProvider.GetBitmapBundle(wx.ART_ERROR))
tb1.AddSeparator()
tb1.AddTool(102, "Test", wx.ArtProvider.GetBitmap(wx.ART_QUESTION))
tb1.AddTool(103, "Test", wx.ArtProvider.GetBitmap(wx.ART_INFORMATION))
tb1.AddTool(103, "Test", wx.ArtProvider.GetBitmap(wx.ART_WARNING))
tb1.AddTool(103, "Test", wx.ArtProvider.GetBitmap(wx.ART_MISSING_IMAGE))
tb1.AddTool(102, "Test", wx.ArtProvider.GetBitmapBundle(wx.ART_QUESTION))
tb1.AddTool(103, "Test", wx.ArtProvider.GetBitmapBundle(wx.ART_INFORMATION))
tb1.AddTool(103, "Test", wx.ArtProvider.GetBitmapBundle(wx.ART_WARNING))
tb1.AddTool(103, "Test", wx.ArtProvider.GetBitmapBundle(wx.ART_MISSING_IMAGE))
tb1.Realize()
tb2 = wx.ToolBar(self, -1, wx.DefaultPosition, wx.DefaultSize,
wx.TB_FLAT | wx.TB_NODIVIDER)
tb2.SetToolBitmapSize(wx.Size(16,16))
tb2_bmp1 = wx.ArtProvider.GetBitmap(wx.ART_QUESTION, wx.ART_OTHER, wx.Size(16, 16))
tb2_bmp1 = wx.ArtProvider.GetBitmapBundle(wx.ART_QUESTION, wx.ART_OTHER, wx.Size(16, 16))
tb2.AddTool(101, "Test", tb2_bmp1)
tb2.AddTool(101, "Test", tb2_bmp1)
tb2.AddTool(101, "Test", tb2_bmp1)
@@ -186,7 +186,7 @@ class PyAUIFrame(wx.Frame):
tb3 = wx.ToolBar(self, -1, wx.DefaultPosition, wx.DefaultSize,
wx.TB_FLAT | wx.TB_NODIVIDER)
tb3.SetToolBitmapSize(wx.Size(16,16))
tb3_bmp1 = wx.ArtProvider.GetBitmap(wx.ART_FOLDER, wx.ART_OTHER, wx.Size(16, 16))
tb3_bmp1 = wx.ArtProvider.GetBitmapBundle(wx.ART_FOLDER, wx.ART_OTHER, wx.Size(16, 16))
tb3.AddTool(101, "Test", tb3_bmp1)
tb3.AddTool(101, "Test", tb3_bmp1)
tb3.AddTool(101, "Test", tb3_bmp1)
@@ -199,7 +199,7 @@ class PyAUIFrame(wx.Frame):
tb4 = wx.ToolBar(self, -1, wx.DefaultPosition, wx.DefaultSize,
wx.TB_FLAT | wx.TB_NODIVIDER | wx.TB_HORZ_TEXT)
tb4.SetToolBitmapSize(wx.Size(16,16))
tb4_bmp1 = wx.ArtProvider.GetBitmap(wx.ART_NORMAL_FILE, wx.ART_OTHER, wx.Size(16, 16))
tb4_bmp1 = wx.ArtProvider.GetBitmapBundle(wx.ART_NORMAL_FILE, wx.ART_OTHER, wx.Size(16, 16))
tb4.AddTool(101, "Item 1", tb4_bmp1)
tb4.AddTool(101, "Item 2", tb4_bmp1)
tb4.AddTool(101, "Item 3", tb4_bmp1)
@@ -214,12 +214,12 @@ class PyAUIFrame(wx.Frame):
tb5 = wx.ToolBar(self, -1, wx.DefaultPosition, wx.DefaultSize,
wx.TB_FLAT | wx.TB_NODIVIDER | wx.TB_VERTICAL)
tb5.SetToolBitmapSize(wx.Size(48, 48))
tb5.AddTool(101, "Test", wx.ArtProvider.GetBitmap(wx.ART_ERROR))
tb5.AddTool(101, "Test", wx.ArtProvider.GetBitmapBundle(wx.ART_ERROR))
tb5.AddSeparator()
tb5.AddTool(102, "Test", wx.ArtProvider.GetBitmap(wx.ART_QUESTION))
tb5.AddTool(103, "Test", wx.ArtProvider.GetBitmap(wx.ART_INFORMATION))
tb5.AddTool(103, "Test", wx.ArtProvider.GetBitmap(wx.ART_WARNING))
tb5.AddTool(103, "Test", wx.ArtProvider.GetBitmap(wx.ART_MISSING_IMAGE))
tb5.AddTool(102, "Test", wx.ArtProvider.GetBitmapBundle(wx.ART_QUESTION))
tb5.AddTool(103, "Test", wx.ArtProvider.GetBitmapBundle(wx.ART_INFORMATION))
tb5.AddTool(103, "Test", wx.ArtProvider.GetBitmapBundle(wx.ART_WARNING))
tb5.AddTool(103, "Test", wx.ArtProvider.GetBitmapBundle(wx.ART_MISSING_IMAGE))
tb5.Realize()
# add a bunch of panes
@@ -767,7 +767,7 @@ class SizeReportCtrl(wx.Control):
dc.SetPen(wx.LIGHT_GREY_PEN)
dc.DrawLine(0, 0, size.x, size.y)
dc.DrawLine(0, size.y, size.x, 0)
dc.DrawText(s, (size.x-w)/2, ((size.y-(height*5))/2))
dc.DrawText(s, int((size.x-w)/2), int((size.y-(height*5))/2))
if self._mgr:
@@ -775,19 +775,19 @@ class SizeReportCtrl(wx.Control):
s = ("Layer: %d")%pi.dock_layer
w, h = dc.GetTextExtent(s)
dc.DrawText(s, (size.x-w)/2, ((size.y-(height*5))/2)+(height*1))
dc.DrawText(s, int((size.x-w)/2), int(((size.y-(height*5))/2)+(height*1)))
s = ("Dock: %d Row: %d")%(pi.dock_direction, pi.dock_row)
w, h = dc.GetTextExtent(s)
dc.DrawText(s, (size.x-w)/2, ((size.y-(height*5))/2)+(height*2))
dc.DrawText(s, int((size.x-w)/2), int(((size.y-(height*5))/2)+(height*2)))
s = ("Position: %d")%pi.dock_pos
w, h = dc.GetTextExtent(s)
dc.DrawText(s, (size.x-w)/2, ((size.y-(height*5))/2)+(height*3))
dc.DrawText(s, int((size.x-w)/2), int(((size.y-(height*5))/2)+(height*3)))
s = ("Proportion: %d")%pi.dock_proportion
w, h = dc.GetTextExtent(s)
dc.DrawText(s, (size.x-w)/2, ((size.y-(height*5))/2)+(height*4))
dc.DrawText(s, int((size.x-w)/2), int(((size.y-(height*5))/2)+(height*4)))
def OnEraseBackground(self, event):
@@ -1002,37 +1002,41 @@ class SettingsPanel(wx.Panel):
return image.ConvertToBitmap()
def CreateColorBitmapBundle(self, c):
return wx.BitmapBundle(self.CreateColorBitmap(c))
def UpdateColors(self):
bk = self._frame.GetDockArt().GetColour(aui.AUI_DOCKART_BACKGROUND_COLOUR)
self._background_color.SetBitmapLabel(self.CreateColorBitmap(bk))
self._background_color.SetBitmapLabel(self.CreateColorBitmapBundle(bk))
cap = self._frame.GetDockArt().GetColour(aui.AUI_DOCKART_INACTIVE_CAPTION_COLOUR)
self._inactive_caption_color.SetBitmapLabel(self.CreateColorBitmap(cap))
self._inactive_caption_color.SetBitmapLabel(self.CreateColorBitmapBundle(cap))
capgrad = self._frame.GetDockArt().GetColour(aui.AUI_DOCKART_INACTIVE_CAPTION_GRADIENT_COLOUR)
self._inactive_caption_gradient_color.SetBitmapLabel(self.CreateColorBitmap(capgrad))
self._inactive_caption_gradient_color.SetBitmapLabel(self.CreateColorBitmapBundle(capgrad))
captxt = self._frame.GetDockArt().GetColour(aui.AUI_DOCKART_INACTIVE_CAPTION_TEXT_COLOUR)
self._inactive_caption_text_color.SetBitmapLabel(self.CreateColorBitmap(captxt))
self._inactive_caption_text_color.SetBitmapLabel(self.CreateColorBitmapBundle(captxt))
acap = self._frame.GetDockArt().GetColour(aui.AUI_DOCKART_ACTIVE_CAPTION_COLOUR)
self._active_caption_color.SetBitmapLabel(self.CreateColorBitmap(acap))
self._active_caption_color.SetBitmapLabel(self.CreateColorBitmapBundle(acap))
acapgrad = self._frame.GetDockArt().GetColour(aui.AUI_DOCKART_ACTIVE_CAPTION_GRADIENT_COLOUR)
self._active_caption_gradient_color.SetBitmapLabel(self.CreateColorBitmap(acapgrad))
self._active_caption_gradient_color.SetBitmapLabel(self.CreateColorBitmapBundle(acapgrad))
acaptxt = self._frame.GetDockArt().GetColour(aui.AUI_DOCKART_ACTIVE_CAPTION_TEXT_COLOUR)
self._active_caption_text_color.SetBitmapLabel(self.CreateColorBitmap(acaptxt))
self._active_caption_text_color.SetBitmapLabel(self.CreateColorBitmapBundle(acaptxt))
sash = self._frame.GetDockArt().GetColour(aui.AUI_DOCKART_SASH_COLOUR)
self._sash_color.SetBitmapLabel(self.CreateColorBitmap(sash))
self._sash_color.SetBitmapLabel(self.CreateColorBitmapBundle(sash))
border = self._frame.GetDockArt().GetColour(aui.AUI_DOCKART_BORDER_COLOUR)
self._border_color.SetBitmapLabel(self.CreateColorBitmap(border))
self._border_color.SetBitmapLabel(self.CreateColorBitmapBundle(border))
gripper = self._frame.GetDockArt().GetColour(aui.AUI_DOCKART_GRIPPER_COLOUR)
self._gripper_color.SetBitmapLabel(self.CreateColorBitmap(gripper))
self._gripper_color.SetBitmapLabel(self.CreateColorBitmapBundle(gripper))
def OnPaneBorderSize(self, event):

View File

@@ -46,7 +46,7 @@ class TestPanel(wx.Panel):
# we need to make it be the same size as the primary image, so
# grab a subsection of this new image
cropped = img.GetSubImage((20, 20, bmp.GetWidth(), bmp.GetHeight()))
b.SetBitmapPressed(cropped.ConvertToBitmap())
b.SetBitmapPressed(wx.BitmapBundle(cropped.ConvertToBitmap()))
b.SetToolTip("This is a bitmap button with \nwx.NO_BORDER style.")
self.Bind(wx.EVT_BUTTON, self.OnClick, b)

View File

@@ -30,7 +30,7 @@ class TestPanel(wx.Panel):
"above or below the label.")
self.Bind(wx.EVT_BUTTON, self.OnClick, b)
b.SetBitmap(images.Mondrian.Bitmap,
b.SetBitmap(wx.BitmapBundle(images.Mondrian.Bitmap),
wx.LEFT # Left is the default, the image can be on the other sides too
#wx.RIGHT
#wx.TOP

View File

@@ -23,7 +23,7 @@ class TestPanel(wx.Panel):
panel.Move((50,50))
b = wx.ToggleButton(self, -1, "can have bitmaps too", pos=(50,125))
b.SetBitmap(images.Mondrian.Bitmap)
b.SetBitmap(wx.BitmapBundle(images.Mondrian.Bitmap))
b.SetInitialSize() # adjust default size for the bitmap
self.Bind(wx.EVT_TOGGLEBUTTON, self.OnToggle, b)

View File

@@ -86,36 +86,38 @@ class TestToolBar(wx.Frame):
self.CreateStatusBar()
tsize = (24,24)
new_bmp = wx.ArtProvider.GetBitmap(wx.ART_NEW, wx.ART_TOOLBAR, tsize)
open_bmp = wx.ArtProvider.GetBitmap(wx.ART_FILE_OPEN, wx.ART_TOOLBAR, tsize)
copy_bmp = wx.ArtProvider.GetBitmap(wx.ART_COPY, wx.ART_TOOLBAR, tsize)
paste_bmp= wx.ArtProvider.GetBitmap(wx.ART_PASTE, wx.ART_TOOLBAR, tsize)
new_bmp = wx.ArtProvider.GetBitmapBundle(wx.ART_NEW, wx.ART_TOOLBAR, tsize)
open_bmp = wx.ArtProvider.GetBitmapBundle(wx.ART_FILE_OPEN, wx.ART_TOOLBAR, tsize)
copy_bmp = wx.ArtProvider.GetBitmapBundle(wx.ART_COPY, wx.ART_TOOLBAR, tsize)
paste_bmp= wx.ArtProvider.GetBitmapBundle(wx.ART_PASTE, wx.ART_TOOLBAR, tsize)
null_bmp = wx.BitmapBundle(wx.NullBitmap)
tb.SetToolBitmapSize(tsize)
#tb.AddTool(10, new_bmp, "New", "Long help for 'New'")
tb.AddTool(10, "New", new_bmp, wx.NullBitmap, wx.ITEM_NORMAL, "New", "Long help for 'New'", None)
tb.AddTool(10, "New", new_bmp, null_bmp, wx.ITEM_NORMAL, "New", "Long help for 'New'", None)
self.Bind(wx.EVT_TOOL, self.OnToolClick, id=10)
self.Bind(wx.EVT_TOOL_RCLICKED, self.OnToolRClick, id=10)
#tb.AddTool(20, open_bmp, "Open", "Long help for 'Open'")
tb.AddTool(20, "Open", open_bmp, wx.NullBitmap, wx.ITEM_NORMAL, "Open", "Long help for 'Open'", None)
tb.AddTool(20, "Open", open_bmp, null_bmp, wx.ITEM_NORMAL, "Open", "Long help for 'Open'", None)
self.Bind(wx.EVT_TOOL, self.OnToolClick, id=20)
self.Bind(wx.EVT_TOOL_RCLICKED, self.OnToolRClick, id=20)
tb.AddSeparator()
tb.AddTool(30, "Copy", copy_bmp, wx.NullBitmap, wx.ITEM_NORMAL, "Copy", "Long help for 'Copy'", None)
tb.AddTool(30, "Copy", copy_bmp, null_bmp, wx.ITEM_NORMAL, "Copy", "Long help for 'Copy'", None)
self.Bind(wx.EVT_TOOL, self.OnToolClick, id=30)
self.Bind(wx.EVT_TOOL_RCLICKED, self.OnToolRClick, id=30)
tb.AddTool(40, "Paste", paste_bmp, wx.NullBitmap, wx.ITEM_NORMAL, "Paste", "Long help for 'Paste'", None)
tb.AddTool(40, "Paste", paste_bmp, null_bmp, wx.ITEM_NORMAL, "Paste", "Long help for 'Paste'", None)
self.Bind(wx.EVT_TOOL, self.OnToolClick, id=40)
self.Bind(wx.EVT_TOOL_RCLICKED, self.OnToolRClick, id=40)
tb.AddSeparator()
#tool = tb.AddCheckTool(50, images.Tog1.GetBitmap(), shortHelp="Toggle this")
tool = tb.AddTool(50, "Checkable", images.Tog1.GetBitmap(),
tool = tb.AddTool(50, "Checkable",
wx.BitmapBundle(images.Tog1.GetBitmap()),
shortHelp="Toggle this", kind=wx.ITEM_CHECK)
self.Bind(wx.EVT_TOOL, self.OnToolClick, id=50)

View File

@@ -148,7 +148,7 @@ class TestPanel(wx.Panel):
def OnRunSimpleWizard(self, evt):
# Create the wizard and the pages
wizard = wiz(self, -1, "Simple Wizard", images.WizTest1.GetBitmap())
wizard = wiz(self, -1, "Simple Wizard", wx.BitmapBundle(images.WizTest1.GetBitmap()))
page1 = TitledPage(wizard, "Page 1")
page2 = TitledPage(wizard, "Page 2")
page3 = TitledPage(wizard, "Page 3")
@@ -181,7 +181,7 @@ wxWizardPageSimple class can easily be used for the pages."""))
#wizard.SetExtraStyle(wx.WIZARD_EX_HELPBUTTON)
#wizard.Create(self, self.ID_wiz, "Simple Wizard",
# images.WizTest1.GetBitmap())
wizard = wiz(self, -1, "Dynamic Wizard", images.WizTest1.GetBitmap())
wizard = wiz(self, -1, "Dynamic Wizard", wx.BitmapBundle(images.WizTest1.GetBitmap()))
page1 = TitledPage(wizard, "Page 1")
page2 = SkipNextPage(wizard, "Page 2")

View File

@@ -621,40 +621,44 @@ class SettingsPanel(wx.Panel):
return image.ConvertToBitmap()
def CreateColourBitmapBundle(self, c):
return wx.BitmapBundle(self.CreateColourBitmap(c))
def UpdateColours(self):
bk = self._frame.GetDockArt().GetColour(aui.AUI_DOCKART_BACKGROUND_COLOUR)
self._background_colour.SetBitmapLabel(self.CreateColourBitmap(bk))
self._background_colour.SetBitmapLabel(self.CreateColourBitmapBundle(bk))
cap = self._frame.GetDockArt().GetColour(aui.AUI_DOCKART_INACTIVE_CAPTION_COLOUR)
self._inactive_caption_colour.SetBitmapLabel(self.CreateColourBitmap(cap))
self._inactive_caption_colour.SetBitmapLabel(self.CreateColourBitmapBundle(cap))
capgrad = self._frame.GetDockArt().GetColour(aui.AUI_DOCKART_INACTIVE_CAPTION_GRADIENT_COLOUR)
self._inactive_caption_gradient_colour.SetBitmapLabel(self.CreateColourBitmap(capgrad))
self._inactive_caption_gradient_colour.SetBitmapLabel(self.CreateColourBitmapBundle(capgrad))
captxt = self._frame.GetDockArt().GetColour(aui.AUI_DOCKART_INACTIVE_CAPTION_TEXT_COLOUR)
self._inactive_caption_text_colour.SetBitmapLabel(self.CreateColourBitmap(captxt))
self._inactive_caption_text_colour.SetBitmapLabel(self.CreateColourBitmapBundle(captxt))
acap = self._frame.GetDockArt().GetColour(aui.AUI_DOCKART_ACTIVE_CAPTION_COLOUR)
self._active_caption_colour.SetBitmapLabel(self.CreateColourBitmap(acap))
self._active_caption_colour.SetBitmapLabel(self.CreateColourBitmapBundle(acap))
acapgrad = self._frame.GetDockArt().GetColour(aui.AUI_DOCKART_ACTIVE_CAPTION_GRADIENT_COLOUR)
self._active_caption_gradient_colour.SetBitmapLabel(self.CreateColourBitmap(acapgrad))
self._active_caption_gradient_colour.SetBitmapLabel(self.CreateColourBitmapBundle(acapgrad))
acaptxt = self._frame.GetDockArt().GetColour(aui.AUI_DOCKART_ACTIVE_CAPTION_TEXT_COLOUR)
self._active_caption_text_colour.SetBitmapLabel(self.CreateColourBitmap(acaptxt))
self._active_caption_text_colour.SetBitmapLabel(self.CreateColourBitmapBundle(acaptxt))
sash = self._frame.GetDockArt().GetColour(aui.AUI_DOCKART_SASH_COLOUR)
self._sash_colour.SetBitmapLabel(self.CreateColourBitmap(sash))
self._sash_colour.SetBitmapLabel(self.CreateColourBitmapBundle(sash))
border = self._frame.GetDockArt().GetColour(aui.AUI_DOCKART_BORDER_COLOUR)
self._border_colour.SetBitmapLabel(self.CreateColourBitmap(border))
self._border_colour.SetBitmapLabel(self.CreateColourBitmapBundle(border))
gripper = self._frame.GetDockArt().GetColour(aui.AUI_DOCKART_GRIPPER_COLOUR)
self._gripper_colour.SetBitmapLabel(self.CreateColourBitmap(gripper))
self._gripper_colour.SetBitmapLabel(self.CreateColourBitmapBundle(gripper))
hint = self._frame.GetDockArt().GetColour(aui.AUI_DOCKART_HINT_WINDOW_COLOUR)
self._hint_colour.SetBitmapLabel(self.CreateColourBitmap(hint))
self._hint_colour.SetBitmapLabel(self.CreateColourBitmapBundle(hint))
def OnPaneBorderSize(self, event):

View File

@@ -119,7 +119,7 @@ class BalloonTipDemo(wx.Frame):
button2 = wx.Button(panel, -1, "Disable BalloonTip")
tbicon = TaskBarIcon()
tbicon.SetIcon(images.Mondrian.GetIcon())
tbicon.SetIcon(wx.BitmapBundle(images.Mondrian.GetIcon()))
controls = list(panel.GetChildren())
controls.append(tbicon)