mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2025-12-15 17:20:07 +01:00
More minor demo fixes and updates for Py3, Phoenix, etc.
This commit is contained in:
@@ -47,11 +47,11 @@ class TestWindow(stc.StyledTextCtrl):
|
||||
wx.Font(fSize, wx.FONTFAMILY_MODERN, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL)
|
||||
)
|
||||
|
||||
## if self.doc:
|
||||
## self.SetDocPointer(self.doc)
|
||||
## else:
|
||||
self.SetText(sampleText)
|
||||
TestWindow.doc = self.GetDocPointer()
|
||||
if self.doc:
|
||||
self.SetDocPointer(self.doc)
|
||||
else:
|
||||
self.SetText(sampleText)
|
||||
TestWindow.doc = self.GetDocPointer()
|
||||
|
||||
|
||||
def ShutDownDemo(self):
|
||||
|
||||
@@ -1 +1 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python
|
||||
@@ -26,7 +26,8 @@ class TestPanel(wx.Panel):
|
||||
self.endPos = None
|
||||
self.overlay = wx.Overlay()
|
||||
|
||||
self.cropbitmap = wx.Bitmap('bitmaps/cropshot24x20.png', wx.BITMAP_TYPE_PNG)
|
||||
self.cropbitmap = wx.Bitmap('bitmaps/cropshot24x20.png')
|
||||
self.honeyBitmap = wx.Bitmap('bitmaps/honeycomb300.png')
|
||||
|
||||
self.wxPenStylesDict = OrderedDict([
|
||||
('Solid' , wx.PENSTYLE_SOLID),
|
||||
@@ -36,39 +37,47 @@ class TestPanel(wx.Panel):
|
||||
('Dot Dash' , wx.PENSTYLE_DOT_DASH),
|
||||
('User Dash' , wx.PENSTYLE_USER_DASH),
|
||||
('Transparent' , wx.PENSTYLE_TRANSPARENT),
|
||||
('Stipple' , wx.PENSTYLE_STIPPLE),
|
||||
#('Stipple' , wx.PENSTYLE_STIPPLE),
|
||||
('BDiagonal Hatch' , wx.PENSTYLE_BDIAGONAL_HATCH),
|
||||
('CrossDiag Hatch' , wx.PENSTYLE_CROSSDIAG_HATCH),
|
||||
('FDiagonal Hatch' , wx.PENSTYLE_FDIAGONAL_HATCH),
|
||||
('Cross Hatch' , wx.PENSTYLE_CROSS_HATCH),
|
||||
('Horizontal Hatch' , wx.PENSTYLE_HORIZONTAL_HATCH),
|
||||
('Vertical Hatch' , wx.PENSTYLE_VERTICAL_HATCH),
|
||||
('First Hatch' , wx.PENSTYLE_FIRST_HATCH),
|
||||
('Last Hatch' , wx.PENSTYLE_LAST_HATCH),
|
||||
])
|
||||
|
||||
list = []
|
||||
for key, value in self.wxPenStylesDict.items():
|
||||
list.append(key)
|
||||
self.penstylesCombo = wx.ComboBox(self, -1, choices=list,
|
||||
pos=(10, 5), size=(100, -1),
|
||||
size=(150, -1),
|
||||
style=wx.CB_READONLY)
|
||||
self.penstylesCombo.SetSelection(0)
|
||||
self.penstylesCombo.SetToolTip('Pen Style')
|
||||
|
||||
self.overlayPenWidth = wx.SpinCtrl(self, -1, value='',
|
||||
pos=(120, 5),
|
||||
size=(100, -1),
|
||||
size=(75, -1),
|
||||
style=wx.SP_ARROW_KEYS,
|
||||
min=1, max=24, initial=1)
|
||||
self.overlayPenWidth.SetToolTip('Pen Width')
|
||||
|
||||
self.overlayPenColor = wx.ColourPickerCtrl(self, -1, colour=wx.BLUE,
|
||||
pos=(230, 5), size=(100, -1))
|
||||
from wx.lib.colourselect import ColourSelect
|
||||
self.overlayPenColor = ColourSelect(self, -1, colour=wx.BLUE)
|
||||
self.overlayPenColor.SetToolTip('Pen Color')
|
||||
|
||||
sizer = wx.BoxSizer(wx.HORIZONTAL)
|
||||
sizer.Add(self.penstylesCombo, 0, wx.ALL, 5)
|
||||
sizer.Add(self.overlayPenWidth, 0, wx.ALL, 5)
|
||||
sizer.Add(self.overlayPenColor, 0, wx.ALL, 5)
|
||||
box = wx.BoxSizer(wx.VERTICAL)
|
||||
box.Add(sizer, 0)
|
||||
box.Add((1,1), 1)
|
||||
|
||||
self.SetSizer(box)
|
||||
|
||||
self.OnSize()
|
||||
|
||||
|
||||
def OnLeftDown(self, event):
|
||||
# Capture the mouse and save the starting posiiton for the rubber-band
|
||||
self.CaptureMouse()
|
||||
@@ -77,6 +86,7 @@ class TestPanel(wx.Panel):
|
||||
self.SetFocus()
|
||||
## print('OnLeftDown')
|
||||
|
||||
|
||||
def OnMouseMove(self, event):
|
||||
if event.Dragging() and event.LeftIsDown():
|
||||
evtPos = event.GetPosition()
|
||||
@@ -128,6 +138,7 @@ class TestPanel(wx.Panel):
|
||||
del odc # Make sure the odc is destroyed before the dc is.
|
||||
## print('OnMouseMove')
|
||||
|
||||
|
||||
def OnLeftUp(self, event):
|
||||
if self.HasCapture():
|
||||
self.ReleaseMouse()
|
||||
@@ -146,7 +157,11 @@ class TestPanel(wx.Panel):
|
||||
self.overlay.Reset()
|
||||
## print('OnLeftUp')
|
||||
|
||||
|
||||
def OnSize(self, event=None):
|
||||
if event:
|
||||
event.Skip()
|
||||
|
||||
x, y = self.GetSize()
|
||||
if x <= 0 or y <= 0:
|
||||
return
|
||||
@@ -158,8 +173,9 @@ class TestPanel(wx.Panel):
|
||||
dc.SetBackground(self.background)
|
||||
dc.Clear()
|
||||
|
||||
dc.DrawBitmap(wx.Bitmap('bitmaps/snakey_render.png'), 10, 35)
|
||||
dc.DrawBitmap(wx.Bitmap('bitmaps/honeycomb300.png'), 100, 210)
|
||||
dc.DrawBitmap(self.honeyBitmap, 40, 40)
|
||||
dc.SetFont(wx.Font(wx.FontInfo(18)))
|
||||
dc.DrawText('Drag the mouse on this window.', 325, 100)
|
||||
|
||||
del dc
|
||||
self.Refresh()
|
||||
|
||||
@@ -69,7 +69,7 @@ class TestPopup(wx.PopupWindow):
|
||||
|
||||
def OnRightUp(self, evt):
|
||||
self.Show(False)
|
||||
self.Destroy()
|
||||
wx.CallAfter(self.Destroy)
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user