added font encoding support
some more demos some contributed items into the library many little tweaks and such git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3843 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -46,8 +46,8 @@ class MyFrame(wxFrame):
|
||||
wxDLG_SZE(panel, wxSize(36, -1)),
|
||||
wxTE_READONLY)
|
||||
|
||||
print wxDLG_PNT(panel, wxPoint(24, 4)), wxDLG_SZE(panel, wxSize(36, -1))
|
||||
print wxDLG_PNT(panel, wxPoint(24, 16)),wxDLG_SZE(panel, wxSize(36, -1))
|
||||
#print wxDLG_PNT(panel, wxPoint(24, 4)), wxDLG_SZE(panel, wxSize(36, -1))
|
||||
#print wxDLG_PNT(panel, wxPoint(24, 16)),wxDLG_SZE(panel, wxSize(36, -1))
|
||||
|
||||
|
||||
# This method is called automatically when the CLOSE event is
|
||||
|
@@ -42,7 +42,8 @@ _treeList = [
|
||||
'wxImage', 'PrintFramework', 'wxOGL']),
|
||||
|
||||
('wxPython Library', ['OldSizers', 'Layoutf', 'wxScrolledMessageDialog',
|
||||
'wxMultipleChoiceDialog', 'wxPlotCanvas']),
|
||||
'wxMultipleChoiceDialog', 'wxPlotCanvas', 'wxFloatBar',
|
||||
'PyShell']),
|
||||
|
||||
('Cool Contribs', ['pyTree', 'hangman', 'SlashDot', 'XMLtreeview']),
|
||||
|
||||
@@ -73,7 +74,7 @@ class wxPythonDemo(wxFrame):
|
||||
self.mainmenu = wxMenuBar()
|
||||
menu = wxMenu()
|
||||
exitID = wxNewId()
|
||||
menu.Append(exitID, 'E&xit\tCtrl-X', 'Get the heck outta here!')
|
||||
menu.Append(exitID, 'E&xit\tAlt-X', 'Get the heck outta here!')
|
||||
EVT_MENU(self, exitID, self.OnFileExit)
|
||||
self.mainmenu.Append(menu, '&File')
|
||||
|
||||
@@ -98,7 +99,7 @@ class wxPythonDemo(wxFrame):
|
||||
self.SetMenuBar(self.mainmenu)
|
||||
|
||||
# set the menu accellerator table...
|
||||
aTable = wxAcceleratorTable([(wxACCEL_CTRL, ord('X'), exitID),
|
||||
aTable = wxAcceleratorTable([(wxACCEL_ALT, ord('X'), exitID),
|
||||
(wxACCEL_CTRL, ord('H'), helpID)])
|
||||
self.SetAcceleratorTable(aTable)
|
||||
|
||||
@@ -118,7 +119,6 @@ class wxPythonDemo(wxFrame):
|
||||
EVT_TREE_ITEM_EXPANDED (self.tree, tID, self.OnItemExpanded)
|
||||
EVT_TREE_ITEM_COLLAPSED (self.tree, tID, self.OnItemCollapsed)
|
||||
EVT_TREE_SEL_CHANGED (self.tree, tID, self.OnSelChanged)
|
||||
###EVT_TREE_SEL_CHANGING (self.tree, tID, self.OnSelChanging)
|
||||
|
||||
# Create a Notebook
|
||||
self.nb = wxNotebook(splitter2, -1)
|
||||
@@ -196,7 +196,6 @@ class wxPythonDemo(wxFrame):
|
||||
def OnSelChanged(self, event):
|
||||
if self.dying:
|
||||
return
|
||||
###print 'OnSelChanged entry'
|
||||
|
||||
if self.nb.GetPageCount() == 3:
|
||||
if self.nb.GetSelection() == 2:
|
||||
@@ -209,9 +208,7 @@ class wxPythonDemo(wxFrame):
|
||||
if itemText == 'Overview':
|
||||
self.GetDemoFile('Main.py')
|
||||
self.SetOverview('Overview', overview)
|
||||
#self.nb.ResizeChildren();
|
||||
self.nb.Refresh();
|
||||
#wxYield()
|
||||
self.window = None
|
||||
|
||||
else:
|
||||
@@ -227,18 +224,14 @@ class wxPythonDemo(wxFrame):
|
||||
self.window = module.runTest(self, self.nb, self)
|
||||
if self.window:
|
||||
self.nb.AddPage(self.window, 'Demo')
|
||||
self.nb.ResizeChildren()
|
||||
self.nb.SetSelection(2)
|
||||
self.nb.ResizeChildren();
|
||||
|
||||
else:
|
||||
self.ovr.Clear()
|
||||
self.txt.Clear()
|
||||
self.window = None
|
||||
|
||||
###print 'OnSelChanged exit: ', itemText
|
||||
|
||||
###def OnSelChanging(self, event):
|
||||
### print 'OnSelChanging'
|
||||
|
||||
|
||||
#---------------------------------------------
|
||||
@@ -305,10 +298,8 @@ class wxPythonDemo(wxFrame):
|
||||
except:
|
||||
selectedDemo = None
|
||||
if selectedDemo:
|
||||
###print "---- start ----"
|
||||
self.tree.SelectItem(selectedDemo)
|
||||
self.tree.EnsureVisible(selectedDemo)
|
||||
###print "---- end ----"
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
20
utils/wxPython/demo/PyShell.py
Normal file
20
utils/wxPython/demo/PyShell.py
Normal file
@@ -0,0 +1,20 @@
|
||||
|
||||
from wxPython.wx import *
|
||||
from wxPython.lib.shell import PyShell
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
|
||||
def runTest(frame, nb, log):
|
||||
win = PyShell(nb)
|
||||
win.Show(true)
|
||||
return win
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
|
||||
overview = """
|
||||
A simple GUI version of the interactive interpreter.
|
||||
"""
|
||||
|
@@ -9,10 +9,10 @@ from wxPython.lib.grids import wxGridSizer, wxFlexGridSizer
|
||||
|
||||
def makeSimpleBox1(win):
|
||||
box = wxBoxSizer(wxHORIZONTAL)
|
||||
box.Add(wxButton(win, 1010, "one"), 0, wxGROW)
|
||||
box.Add(wxButton(win, 1010, "two"), 0, wxGROW)
|
||||
box.Add(wxButton(win, 1010, "three"), 0, wxGROW)
|
||||
box.Add(wxButton(win, 1010, "four"), 0, wxGROW)
|
||||
box.Add(wxButton(win, 1010, "one"), 0, wxEXPAND)
|
||||
box.Add(wxButton(win, 1010, "two"), 0, wxEXPAND)
|
||||
box.Add(wxButton(win, 1010, "three"), 0, wxEXPAND)
|
||||
box.Add(wxButton(win, 1010, "four"), 0, wxEXPAND)
|
||||
|
||||
return box
|
||||
|
||||
@@ -20,10 +20,10 @@ def makeSimpleBox1(win):
|
||||
|
||||
def makeSimpleBox2(win):
|
||||
box = wxBoxSizer(wxVERTICAL)
|
||||
box.Add(wxButton(win, 1010, "one"), 0, wxGROW)
|
||||
box.Add(wxButton(win, 1010, "two"), 0, wxGROW)
|
||||
box.Add(wxButton(win, 1010, "three"), 0, wxGROW)
|
||||
box.Add(wxButton(win, 1010, "four"), 0, wxGROW)
|
||||
box.Add(wxButton(win, 1010, "one"), 0, wxEXPAND)
|
||||
box.Add(wxButton(win, 1010, "two"), 0, wxEXPAND)
|
||||
box.Add(wxButton(win, 1010, "three"), 0, wxEXPAND)
|
||||
box.Add(wxButton(win, 1010, "four"), 0, wxEXPAND)
|
||||
|
||||
return box
|
||||
|
||||
@@ -31,11 +31,11 @@ def makeSimpleBox2(win):
|
||||
|
||||
def makeSimpleBox3(win):
|
||||
box = wxBoxSizer(wxHORIZONTAL)
|
||||
box.Add(wxButton(win, 1010, "one"), 0, wxGROW)
|
||||
box.Add(wxButton(win, 1010, "two"), 0, wxGROW)
|
||||
box.Add(wxButton(win, 1010, "three"), 0, wxGROW)
|
||||
box.Add(wxButton(win, 1010, "four"), 0, wxGROW)
|
||||
box.Add(wxButton(win, 1010, "five"), 1, wxGROW)
|
||||
box.Add(wxButton(win, 1010, "one"), 0, wxEXPAND)
|
||||
box.Add(wxButton(win, 1010, "two"), 0, wxEXPAND)
|
||||
box.Add(wxButton(win, 1010, "three"), 0, wxEXPAND)
|
||||
box.Add(wxButton(win, 1010, "four"), 0, wxEXPAND)
|
||||
box.Add(wxButton(win, 1010, "five"), 1, wxEXPAND)
|
||||
|
||||
return box
|
||||
|
||||
@@ -43,11 +43,11 @@ def makeSimpleBox3(win):
|
||||
|
||||
def makeSimpleBox4(win):
|
||||
box = wxBoxSizer(wxHORIZONTAL)
|
||||
box.Add(wxButton(win, 1010, "one"), 0, wxGROW)
|
||||
box.Add(wxButton(win, 1010, "two"), 0, wxGROW)
|
||||
box.Add(wxButton(win, 1010, "three"), 1, wxGROW)
|
||||
box.Add(wxButton(win, 1010, "four"), 1, wxGROW)
|
||||
box.Add(wxButton(win, 1010, "five"), 1, wxGROW)
|
||||
box.Add(wxButton(win, 1010, "one"), 0, wxEXPAND)
|
||||
box.Add(wxButton(win, 1010, "two"), 0, wxEXPAND)
|
||||
box.Add(wxButton(win, 1010, "three"), 1, wxEXPAND)
|
||||
box.Add(wxButton(win, 1010, "four"), 1, wxEXPAND)
|
||||
box.Add(wxButton(win, 1010, "five"), 1, wxEXPAND)
|
||||
|
||||
return box
|
||||
|
||||
@@ -55,11 +55,11 @@ def makeSimpleBox4(win):
|
||||
|
||||
def makeSimpleBox5(win):
|
||||
box = wxBoxSizer(wxHORIZONTAL)
|
||||
box.Add(wxButton(win, 1010, "one"), 0, wxGROW)
|
||||
box.Add(wxButton(win, 1010, "two"), 0, wxGROW)
|
||||
box.Add(wxButton(win, 1010, "three"), 3, wxGROW)
|
||||
box.Add(wxButton(win, 1010, "four"), 1, wxGROW)
|
||||
box.Add(wxButton(win, 1010, "five"), 1, wxGROW)
|
||||
box.Add(wxButton(win, 1010, "one"), 0, wxEXPAND)
|
||||
box.Add(wxButton(win, 1010, "two"), 0, wxEXPAND)
|
||||
box.Add(wxButton(win, 1010, "three"), 3, wxEXPAND)
|
||||
box.Add(wxButton(win, 1010, "four"), 1, wxEXPAND)
|
||||
box.Add(wxButton(win, 1010, "five"), 1, wxEXPAND)
|
||||
|
||||
return box
|
||||
|
||||
@@ -68,9 +68,9 @@ def makeSimpleBox5(win):
|
||||
def makeSimpleBox6(win):
|
||||
box = wxBoxSizer(wxHORIZONTAL)
|
||||
box.Add(wxButton(win, 1010, "one"), 1, wxALIGN_TOP)
|
||||
box.Add(wxButton(win, 1010, "two"), 1, wxGROW)
|
||||
box.Add(wxButton(win, 1010, "two"), 1, wxEXPAND)
|
||||
box.Add(wxButton(win, 1010, "three"), 1, wxCENTER)
|
||||
box.Add(wxButton(win, 1010, "four"), 1, wxGROW)
|
||||
box.Add(wxButton(win, 1010, "four"), 1, wxEXPAND)
|
||||
box.Add(wxButton(win, 1010, "five"), 1, wxALIGN_BOTTOM)
|
||||
|
||||
return box
|
||||
@@ -79,11 +79,11 @@ def makeSimpleBox6(win):
|
||||
|
||||
def makeSimpleBox7(win):
|
||||
box = wxBoxSizer(wxHORIZONTAL)
|
||||
box.Add(wxButton(win, 1010, "one"), 0, wxGROW)
|
||||
box.Add(wxButton(win, 1010, "two"), 0, wxGROW)
|
||||
box.Add(wxButton(win, 1010, "three"), 0, wxGROW)
|
||||
box.Add(60, 20, 0, wxGROW)
|
||||
box.Add(wxButton(win, 1010, "five"), 1, wxGROW)
|
||||
box.Add(wxButton(win, 1010, "one"), 0, wxEXPAND)
|
||||
box.Add(wxButton(win, 1010, "two"), 0, wxEXPAND)
|
||||
box.Add(wxButton(win, 1010, "three"), 0, wxEXPAND)
|
||||
box.Add(60, 20, 0, wxEXPAND)
|
||||
box.Add(wxButton(win, 1010, "five"), 1, wxEXPAND)
|
||||
|
||||
return box
|
||||
|
||||
@@ -94,7 +94,7 @@ def makeSimpleBorder1(win):
|
||||
bdr = wxBoxSizer(wxHORIZONTAL)
|
||||
btn = wxButton(win, 1010, "border")
|
||||
btn.SetSize(wxSize(80, 80))
|
||||
bdr.Add(btn, 1, wxGROW|wxALL, 15)
|
||||
bdr.Add(btn, 1, wxEXPAND|wxALL, 15)
|
||||
|
||||
return bdr
|
||||
|
||||
@@ -104,7 +104,7 @@ def makeSimpleBorder2(win):
|
||||
bdr = wxBoxSizer(wxHORIZONTAL)
|
||||
btn = wxButton(win, 1010, "border")
|
||||
btn.SetSize(wxSize(80, 80))
|
||||
bdr.Add(btn, 1, wxGROW | wxEAST | wxWEST, 15)
|
||||
bdr.Add(btn, 1, wxEXPAND | wxEAST | wxWEST, 15)
|
||||
|
||||
return bdr
|
||||
|
||||
@@ -114,7 +114,7 @@ def makeSimpleBorder3(win):
|
||||
bdr = wxBoxSizer(wxHORIZONTAL)
|
||||
btn = wxButton(win, 1010, "border")
|
||||
btn.SetSize(wxSize(80, 80))
|
||||
bdr.Add(btn, 1, wxGROW | wxNORTH | wxWEST, 15)
|
||||
bdr.Add(btn, 1, wxEXPAND | wxNORTH | wxWEST, 15)
|
||||
|
||||
return bdr
|
||||
|
||||
@@ -124,26 +124,26 @@ def makeSimpleBorder3(win):
|
||||
def makeBoxInBox(win):
|
||||
box = wxBoxSizer(wxVERTICAL)
|
||||
|
||||
box.Add(wxButton(win, 1010, "one"), 0, wxGROW)
|
||||
box.Add(wxButton(win, 1010, "one"), 0, wxEXPAND)
|
||||
|
||||
box2 = wxBoxSizer(wxHORIZONTAL)
|
||||
box2.AddMany([ (wxButton(win, 1010, "two"), 0, wxGROW),
|
||||
(wxButton(win, 1010, "three"), 0, wxGROW),
|
||||
(wxButton(win, 1010, "four"), 0, wxGROW),
|
||||
(wxButton(win, 1010, "five"), 0, wxGROW),
|
||||
box2.AddMany([ (wxButton(win, 1010, "two"), 0, wxEXPAND),
|
||||
(wxButton(win, 1010, "three"), 0, wxEXPAND),
|
||||
(wxButton(win, 1010, "four"), 0, wxEXPAND),
|
||||
(wxButton(win, 1010, "five"), 0, wxEXPAND),
|
||||
])
|
||||
|
||||
box3 = wxBoxSizer(wxVERTICAL)
|
||||
box3.AddMany([ (wxButton(win, 1010, "six"), 0, wxGROW),
|
||||
(wxButton(win, 1010, "seven"), 2, wxGROW),
|
||||
(wxButton(win, 1010, "eight"), 1, wxGROW),
|
||||
(wxButton(win, 1010, "nine"), 1, wxGROW),
|
||||
box3.AddMany([ (wxButton(win, 1010, "six"), 0, wxEXPAND),
|
||||
(wxButton(win, 1010, "seven"), 2, wxEXPAND),
|
||||
(wxButton(win, 1010, "eight"), 1, wxEXPAND),
|
||||
(wxButton(win, 1010, "nine"), 1, wxEXPAND),
|
||||
])
|
||||
|
||||
box2.Add(box3, 1, wxGROW)
|
||||
box.Add(box2, 1, wxGROW)
|
||||
box2.Add(box3, 1, wxEXPAND)
|
||||
box.Add(box2, 1, wxEXPAND)
|
||||
|
||||
box.Add(wxButton(win, 1010, "ten"), 0, wxGROW)
|
||||
box.Add(wxButton(win, 1010, "ten"), 0, wxEXPAND)
|
||||
|
||||
return box
|
||||
|
||||
@@ -152,7 +152,7 @@ def makeBoxInBox(win):
|
||||
def makeBoxInBorder(win):
|
||||
bdr = wxBoxSizer(wxHORIZONTAL)
|
||||
box = makeSimpleBox3(win)
|
||||
bdr.Add(box, 1, wxGROW | wxALL, 15)
|
||||
bdr.Add(box, 1, wxEXPAND | wxALL, 15)
|
||||
|
||||
return bdr
|
||||
|
||||
@@ -162,31 +162,31 @@ def makeBorderInBox(win):
|
||||
insideBox = wxBoxSizer(wxHORIZONTAL)
|
||||
|
||||
box2 = wxBoxSizer(wxHORIZONTAL)
|
||||
box2.AddMany([ (wxButton(win, 1010, "one"), 0, wxGROW),
|
||||
(wxButton(win, 1010, "two"), 0, wxGROW),
|
||||
(wxButton(win, 1010, "three"), 0, wxGROW),
|
||||
(wxButton(win, 1010, "four"), 0, wxGROW),
|
||||
(wxButton(win, 1010, "five"), 0, wxGROW),
|
||||
box2.AddMany([ (wxButton(win, 1010, "one"), 0, wxEXPAND),
|
||||
(wxButton(win, 1010, "two"), 0, wxEXPAND),
|
||||
(wxButton(win, 1010, "three"), 0, wxEXPAND),
|
||||
(wxButton(win, 1010, "four"), 0, wxEXPAND),
|
||||
(wxButton(win, 1010, "five"), 0, wxEXPAND),
|
||||
])
|
||||
|
||||
insideBox.Add(box2, 0, wxGROW)
|
||||
insideBox.Add(box2, 0, wxEXPAND)
|
||||
|
||||
bdr = wxBoxSizer(wxHORIZONTAL)
|
||||
bdr.Add(wxButton(win, 1010, "border"), 1, wxGROW | wxALL)
|
||||
insideBox.Add(bdr, 1, wxGROW | wxALL, 20)
|
||||
bdr.Add(wxButton(win, 1010, "border"), 1, wxEXPAND | wxALL)
|
||||
insideBox.Add(bdr, 1, wxEXPAND | wxALL, 20)
|
||||
|
||||
box3 = wxBoxSizer(wxVERTICAL)
|
||||
box3.AddMany([ (wxButton(win, 1010, "six"), 0, wxGROW),
|
||||
(wxButton(win, 1010, "seven"), 2, wxGROW),
|
||||
(wxButton(win, 1010, "eight"), 1, wxGROW),
|
||||
(wxButton(win, 1010, "nine"), 1, wxGROW),
|
||||
box3.AddMany([ (wxButton(win, 1010, "six"), 0, wxEXPAND),
|
||||
(wxButton(win, 1010, "seven"), 2, wxEXPAND),
|
||||
(wxButton(win, 1010, "eight"), 1, wxEXPAND),
|
||||
(wxButton(win, 1010, "nine"), 1, wxEXPAND),
|
||||
])
|
||||
insideBox.Add(box3, 1, wxGROW)
|
||||
insideBox.Add(box3, 1, wxEXPAND)
|
||||
|
||||
outsideBox = wxBoxSizer(wxVERTICAL)
|
||||
outsideBox.Add(wxButton(win, 1010, "top"), 0, wxGROW)
|
||||
outsideBox.Add(insideBox, 1, wxGROW)
|
||||
outsideBox.Add(wxButton(win, 1010, "bottom"), 0, wxGROW)
|
||||
outsideBox.Add(wxButton(win, 1010, "top"), 0, wxEXPAND)
|
||||
outsideBox.Add(insideBox, 1, wxEXPAND)
|
||||
outsideBox.Add(wxButton(win, 1010, "bottom"), 0, wxEXPAND)
|
||||
|
||||
return outsideBox
|
||||
|
||||
@@ -196,16 +196,16 @@ def makeBorderInBox(win):
|
||||
def makeGrid1(win):
|
||||
gs = wxGridSizer(3, 3, 2, 2) # rows, cols, hgap, vgap
|
||||
|
||||
gs.AddMany([ (wxButton(win, 1010, 'one'), 0, wxGROW),
|
||||
(wxButton(win, 1010, 'two'), 0, wxGROW),
|
||||
(wxButton(win, 1010, 'three'), 0, wxGROW),
|
||||
(wxButton(win, 1010, 'four'), 0, wxGROW),
|
||||
(wxButton(win, 1010, 'five'), 0, wxGROW),
|
||||
gs.AddMany([ (wxButton(win, 1010, 'one'), 0, wxEXPAND),
|
||||
(wxButton(win, 1010, 'two'), 0, wxEXPAND),
|
||||
(wxButton(win, 1010, 'three'), 0, wxEXPAND),
|
||||
(wxButton(win, 1010, 'four'), 0, wxEXPAND),
|
||||
(wxButton(win, 1010, 'five'), 0, wxEXPAND),
|
||||
#(75, 50),
|
||||
(wxButton(win, 1010, 'six'), 0, wxGROW),
|
||||
(wxButton(win, 1010, 'seven'), 0, wxGROW),
|
||||
(wxButton(win, 1010, 'eight'), 0, wxGROW),
|
||||
(wxButton(win, 1010, 'nine'), 0, wxGROW),
|
||||
(wxButton(win, 1010, 'six'), 0, wxEXPAND),
|
||||
(wxButton(win, 1010, 'seven'), 0, wxEXPAND),
|
||||
(wxButton(win, 1010, 'eight'), 0, wxEXPAND),
|
||||
(wxButton(win, 1010, 'nine'), 0, wxEXPAND),
|
||||
])
|
||||
|
||||
return gs
|
||||
@@ -216,24 +216,24 @@ def makeGrid2(win):
|
||||
gs = wxGridSizer(3, 3) # rows, cols, hgap, vgap
|
||||
|
||||
box = wxBoxSizer(wxVERTICAL)
|
||||
box.Add(wxButton(win, 1010, 'A'), 0, wxGROW)
|
||||
box.Add(wxButton(win, 1010, 'B'), 1, wxGROW)
|
||||
box.Add(wxButton(win, 1010, 'A'), 0, wxEXPAND)
|
||||
box.Add(wxButton(win, 1010, 'B'), 1, wxEXPAND)
|
||||
|
||||
gs2 = wxGridSizer(2,2, 4, 4)
|
||||
gs2.AddMany([ (wxButton(win, 1010, 'C'), 0, wxGROW),
|
||||
(wxButton(win, 1010, 'E'), 0, wxGROW),
|
||||
(wxButton(win, 1010, 'F'), 0, wxGROW),
|
||||
(wxButton(win, 1010, 'G'), 0, wxGROW)])
|
||||
gs2.AddMany([ (wxButton(win, 1010, 'C'), 0, wxEXPAND),
|
||||
(wxButton(win, 1010, 'E'), 0, wxEXPAND),
|
||||
(wxButton(win, 1010, 'F'), 0, wxEXPAND),
|
||||
(wxButton(win, 1010, 'G'), 0, wxEXPAND)])
|
||||
|
||||
gs.AddMany([ (wxButton(win, 1010, 'one'), 0, wxALIGN_RIGHT | wxALIGN_BOTTOM),
|
||||
(wxButton(win, 1010, 'two'), 0, wxGROW),
|
||||
(wxButton(win, 1010, 'two'), 0, wxEXPAND),
|
||||
(wxButton(win, 1010, 'three'), 0, wxALIGN_LEFT | wxALIGN_BOTTOM),
|
||||
(wxButton(win, 1010, 'four'), 0, wxGROW),
|
||||
(wxButton(win, 1010, 'four'), 0, wxEXPAND),
|
||||
(wxButton(win, 1010, 'five'), 0, wxCENTER),
|
||||
(wxButton(win, 1010, 'six'), 0, wxGROW),
|
||||
(box, 0, wxGROW | wxALL, 10),
|
||||
(wxButton(win, 1010, 'eight'), 0, wxGROW),
|
||||
(gs2, 0, wxGROW | wxALL, 4),
|
||||
(wxButton(win, 1010, 'six'), 0, wxEXPAND),
|
||||
(box, 0, wxEXPAND | wxALL, 10),
|
||||
(wxButton(win, 1010, 'eight'), 0, wxEXPAND),
|
||||
(gs2, 0, wxEXPAND | wxALL, 4),
|
||||
])
|
||||
|
||||
return gs
|
||||
@@ -243,16 +243,16 @@ def makeGrid2(win):
|
||||
def makeGrid3(win):
|
||||
gs = wxFlexGridSizer(3, 3, 2, 2) # rows, cols, hgap, vgap
|
||||
|
||||
gs.AddMany([ (wxButton(win, 1010, 'one'), 0, wxGROW),
|
||||
(wxButton(win, 1010, 'two'), 0, wxGROW),
|
||||
(wxButton(win, 1010, 'three'), 0, wxGROW),
|
||||
(wxButton(win, 1010, 'four'), 0, wxGROW),
|
||||
#(wxButton(win, 1010, 'five'), 0, wxGROW),
|
||||
gs.AddMany([ (wxButton(win, 1010, 'one'), 0, wxEXPAND),
|
||||
(wxButton(win, 1010, 'two'), 0, wxEXPAND),
|
||||
(wxButton(win, 1010, 'three'), 0, wxEXPAND),
|
||||
(wxButton(win, 1010, 'four'), 0, wxEXPAND),
|
||||
#(wxButton(win, 1010, 'five'), 0, wxEXPAND),
|
||||
(175, 50),
|
||||
(wxButton(win, 1010, 'six'), 0, wxGROW),
|
||||
(wxButton(win, 1010, 'seven'), 0, wxGROW),
|
||||
(wxButton(win, 1010, 'eight'), 0, wxGROW),
|
||||
(wxButton(win, 1010, 'nine'), 0, wxGROW),
|
||||
(wxButton(win, 1010, 'six'), 0, wxEXPAND),
|
||||
(wxButton(win, 1010, 'seven'), 0, wxEXPAND),
|
||||
(wxButton(win, 1010, 'eight'), 0, wxEXPAND),
|
||||
(wxButton(win, 1010, 'nine'), 0, wxEXPAND),
|
||||
])
|
||||
|
||||
gs.AddGrowableRow(0)
|
||||
|
@@ -23,7 +23,6 @@ class TestPanel(wxPanel):
|
||||
def OnClick(self, event):
|
||||
self.log.WriteText("Click! (%d)\n" % event.GetId())
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
def runTest(frame, nb, log):
|
||||
|
122
utils/wxPython/demo/wxFloatBar.py
Normal file
122
utils/wxPython/demo/wxFloatBar.py
Normal file
@@ -0,0 +1,122 @@
|
||||
from wxPython.wx import *
|
||||
from wxPython.lib.floatbar import *
|
||||
|
||||
class TestFloatBar(wxFrame):
|
||||
def __init__(self, parent, log):
|
||||
wxFrame.__init__(self, parent, -1, 'Test ToolBar',
|
||||
wxPoint(0,0), wxSize(500, 300))
|
||||
self.log = log
|
||||
|
||||
wxWindow(self, -1).SetBackgroundColour(wxNamedColour("WHITE"))
|
||||
|
||||
tb = wxFloatBar(self, -1)
|
||||
self.SetToolBar(tb)
|
||||
tb.SetFloatable(1)
|
||||
tb.SetTitle("Floating!")
|
||||
self.CreateStatusBar()
|
||||
tb.AddTool(10, wxBitmap('bitmaps/new.bmp', wxBITMAP_TYPE_BMP),
|
||||
wxNullBitmap, false, -1, -1, "New", "Long help for 'New'")
|
||||
EVT_TOOL(self, 10, self.OnToolClick)
|
||||
EVT_TOOL_RCLICKED(self, 10, self.OnToolRClick)
|
||||
|
||||
tb.AddTool(20, wxBitmap('bitmaps/open.bmp', wxBITMAP_TYPE_BMP),
|
||||
wxNullBitmap, false, -1, -1, "Open")
|
||||
EVT_TOOL(self, 20, self.OnToolClick)
|
||||
EVT_TOOL_RCLICKED(self, 20, self.OnToolRClick)
|
||||
|
||||
tb.AddSeparator()
|
||||
tb.AddTool(30, wxBitmap('bitmaps/copy.bmp', wxBITMAP_TYPE_BMP),
|
||||
wxNullBitmap, false, -1, -1, "Copy")
|
||||
EVT_TOOL(self, 30, self.OnToolClick)
|
||||
EVT_TOOL_RCLICKED(self, 30, self.OnToolRClick)
|
||||
|
||||
tb.AddTool(40, wxBitmap('bitmaps/paste.bmp', wxBITMAP_TYPE_BMP),
|
||||
wxNullBitmap, false, -1, -1, "Paste")
|
||||
EVT_TOOL(self, 40, self.OnToolClick)
|
||||
EVT_TOOL_RCLICKED(self, 40, self.OnToolRClick)
|
||||
|
||||
tb.AddSeparator()
|
||||
|
||||
tb.AddTool(50, wxBitmap('bitmaps/tog1.bmp', wxBITMAP_TYPE_BMP),
|
||||
wxNullBitmap, true, -1, -1, "Toggle this")
|
||||
EVT_TOOL(self, 50, self.OnToolClick)
|
||||
EVT_TOOL_RCLICKED(self, 50, self.OnToolRClick)
|
||||
|
||||
tb.AddTool(60, wxBitmap('bitmaps/tog1.bmp', wxBITMAP_TYPE_BMP),
|
||||
wxBitmap('bitmaps/tog2.bmp', wxBITMAP_TYPE_BMP),
|
||||
true, -1, -1, "Toggle with 2 bitmaps")
|
||||
EVT_TOOL(self, 60, self.OnToolClick)
|
||||
EVT_TOOL_RCLICKED(self, 60, self.OnToolRClick)
|
||||
tb.Realize()
|
||||
# b = wxButton(tb, -1, "HELLO!")
|
||||
# EVT_BUTTON(b, b.GetId(), self.test)
|
||||
|
||||
|
||||
def OnCloseWindow(self, event):
|
||||
self.Destroy()
|
||||
|
||||
def OnToolClick(self, event):
|
||||
self.log.WriteText("tool %s clicked\n" % event.GetId())
|
||||
|
||||
def OnToolRClick(self, event):
|
||||
self.log.WriteText("tool %s right-clicked\n" % event.GetId())
|
||||
# def test(self, event):
|
||||
# self.log.WriteText("Button clicked!")
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def runTest(frame, nb, log):
|
||||
win = TestFloatBar(frame, log)
|
||||
frame.otherWin = win
|
||||
win.Show(true)
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
overview = """\
|
||||
wxFloatBar is a subclass of wxToolBar, implemented in Python, which can be detached from its frame.
|
||||
|
||||
Drag the toolbar with the mouse to make it float, and drag it back, or close it to make the toolbar
|
||||
|
||||
return to its original position.
|
||||
|
||||
wxFloatBar()
|
||||
-----------------------
|
||||
|
||||
Default constructor.
|
||||
|
||||
wxFloatBar(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTB_HORIZONTAL | wxNO_BORDER, const wxString& name = wxPanelNameStr)
|
||||
|
||||
Constructs a floatable toolbar.
|
||||
|
||||
Parameters
|
||||
-------------------
|
||||
|
||||
parent = Pointer to a parent window.
|
||||
|
||||
id = Window identifier. If -1, will automatically create an identifier.
|
||||
|
||||
pos = Window position. wxDefaultPosition is (-1, -1) which indicates that wxWindows should generate a default position for the window. If using the wxWindow class directly, supply an actual position.
|
||||
|
||||
size = Window size. wxDefaultSize is (-1, -1) which indicates that wxWindows should generate a default size for the window.
|
||||
|
||||
style = Window style. Se wxToolBar for details.
|
||||
|
||||
name = Window name.
|
||||
"""
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -6,11 +6,11 @@ from wxPython.wx import *
|
||||
class TestLayoutConstraints(wxWindow):
|
||||
def __init__(self, parent):
|
||||
wxWindow.__init__(self, parent, -1)
|
||||
self.SetBackgroundColour(wxNamedColour("MEDIUM ORCHID"))
|
||||
|
||||
self.SetAutoLayout(true)
|
||||
EVT_BUTTON(self, 100, self.OnButton)
|
||||
|
||||
self.SetBackgroundColour(wxNamedColour("MEDIUM ORCHID"))
|
||||
|
||||
self.panelA = wxWindow(self, -1, wxDefaultPosition, wxDefaultSize,
|
||||
wxSIMPLE_BORDER)
|
||||
self.panelA.SetBackgroundColour(wxBLUE)
|
||||
@@ -86,6 +86,8 @@ class TestLayoutConstraints(wxWindow):
|
||||
self.panelD.SetConstraints(lc);
|
||||
|
||||
|
||||
|
||||
|
||||
def OnButton(self, event):
|
||||
wxBell()
|
||||
|
||||
|
@@ -1,17 +1,22 @@
|
||||
|
||||
from wxPython.wx import *
|
||||
|
||||
import ColorPanel
|
||||
import wxGrid
|
||||
import wxListCtrl
|
||||
import wxScrolledWindow
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
def runTest(frame, nb, log):
|
||||
|
||||
testWin = wxNotebook(nb, -1)
|
||||
testWin = wxNotebook(nb, -1, style=wxNB_BOTTOM)
|
||||
|
||||
win = ColorPanel.ColoredPanel(testWin, wxBLUE)
|
||||
testWin.AddPage(win, "Blue")
|
||||
st = wxStaticText(win, -1,
|
||||
"You can put nearly any type of window here!",
|
||||
"You can put nearly any type of window here,\n"
|
||||
"and the tabs can be on any side... (look below.)",
|
||||
wxPoint(10, 10))
|
||||
st.SetForegroundColour(wxWHITE)
|
||||
st.SetBackgroundColour(wxBLUE)
|
||||
@@ -19,9 +24,18 @@ def runTest(frame, nb, log):
|
||||
win = ColorPanel.ColoredPanel(testWin, wxRED)
|
||||
testWin.AddPage(win, "Red")
|
||||
|
||||
win = wxScrolledWindow.MyCanvas(testWin)
|
||||
testWin.AddPage(win, 'ScrolledWindow')
|
||||
|
||||
win = ColorPanel.ColoredPanel(testWin, wxGREEN)
|
||||
testWin.AddPage(win, "Green")
|
||||
|
||||
win = wxGrid.TestGrid(testWin, log)
|
||||
testWin.AddPage(win, "Grid")
|
||||
|
||||
win = wxListCtrl.TestListCtrlPanel(testWin, log)
|
||||
testWin.AddPage(win, 'List')
|
||||
|
||||
win = ColorPanel.ColoredPanel(testWin, wxCYAN)
|
||||
testWin.AddPage(win, "Cyan")
|
||||
|
||||
|
@@ -16,7 +16,7 @@ class TestRadioButtons(wxPanel):
|
||||
EVT_RADIOBOX(self, 30, self.EvtRadioBox)
|
||||
|
||||
|
||||
rb = wxRadioBox(self, 30, "wxRadioBox", wxPoint(35, 120), wxDefaultSize,
|
||||
rb = wxRadioBox(self, 30, "", wxPoint(35, 120), wxDefaultSize,
|
||||
sampleList, 3, wxRA_SPECIFY_COLS | wxNO_BORDER)
|
||||
EVT_RADIOBOX(self, 30, self.EvtRadioBox)
|
||||
|
||||
|
Reference in New Issue
Block a user