Copied/merged from the 2.2 branch.
Changes needed to build with new event system git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9374 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
41
wxPython/demo/FancyText.py
Normal file
41
wxPython/demo/FancyText.py
Normal file
@@ -0,0 +1,41 @@
|
||||
|
||||
from wxPython.wx import *
|
||||
from wxPython.lib import fancytext
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
test_str = ('<font style="italic" family="swiss" color="red" weight="bold" >'
|
||||
'some |<sup>23</sup> <angle/>text<sub>with <angle/> subscript</sub>'
|
||||
'</font> some other text')
|
||||
|
||||
test_str2 = '<font family="swiss" color="dark green" size="40">big green text</font>'
|
||||
|
||||
|
||||
class TestPanel(wxPanel):
|
||||
def __init__(self, parent):
|
||||
wxPanel.__init__(self, parent, -1)
|
||||
EVT_PAINT(self, self.OnPaint)
|
||||
|
||||
|
||||
def OnPaint(self, evt):
|
||||
dc = wxPaintDC(self)
|
||||
|
||||
sz = fancytext.getExtent(test_str, dc)
|
||||
fancytext.renderToDC(test_str, dc, 20, 20)
|
||||
|
||||
fancytext.renderToDC(test_str2, dc, 20, 20 + sz.height + 10)
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
def runTest(frame, nb, log):
|
||||
win = TestPanel(nb)
|
||||
return win
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
import string
|
||||
overview = string.replace(fancytext.__doc__, "<", "<")
|
||||
|
@@ -1,6 +1,10 @@
|
||||
""" Demonstrate filebrowsebutton module of the wxPython.lib Library.
|
||||
|
||||
14.1.2001 Bernhard Reiter <bernhard@intevation.de>
|
||||
Added demo for DirBrowseButton and improved overview text.
|
||||
"""
|
||||
from wxPython.wx import *
|
||||
from wxPython.lib.filebrowsebutton import FileBrowseButton, FileBrowseButtonWithHistory
|
||||
from wxPython.lib.filebrowsebutton import FileBrowseButton, FileBrowseButtonWithHistory,DirBrowseButton
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
@@ -15,6 +19,9 @@ class TestPanel(wxPanel):
|
||||
wxSize(450, -1),
|
||||
#changeCallback = self.fbbhCallback
|
||||
)
|
||||
self.dbb = DirBrowseButton(self, -1, wxPoint(20,80), wxSize(450,-1),
|
||||
changeCallback = self.dbbCallback)
|
||||
|
||||
|
||||
self.fbbh.SetHistory(['You', 'can', 'put', 'some', 'file', 'names', 'here'])
|
||||
|
||||
@@ -23,6 +30,7 @@ class TestPanel(wxPanel):
|
||||
self.log.write('FileBrowseButton: %s\n' % evt.GetString())
|
||||
|
||||
|
||||
|
||||
def fbbhCallback(self, evt):
|
||||
if hasattr(self, 'fbbh'):
|
||||
value = evt.GetString()
|
||||
@@ -31,6 +39,10 @@ class TestPanel(wxPanel):
|
||||
history.append(value)
|
||||
self.fbbh.SetHistory(history)
|
||||
|
||||
def dbbCallback(self, evt):
|
||||
self.log.write('DirBrowseButton: %s\n' % evt.GetString())
|
||||
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
@@ -42,6 +54,23 @@ def runTest(frame, nb, log):
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
overview = """<html><body>
|
||||
<h2>class FileBrowseButton:</h2>
|
||||
<small><pre>
|
||||
%s
|
||||
</pre></small>
|
||||
|
||||
<h2>class FileBrowseButtonWithHistory(FileBrowseButton):</h2>
|
||||
<small><pre>
|
||||
%s
|
||||
</pre></small>
|
||||
|
||||
overview = FileBrowseButton.__doc__
|
||||
<h2>class DirBrowseButton(FileBrowseButton):</h2>
|
||||
<small><pre>
|
||||
%s
|
||||
</pre></small>
|
||||
|
||||
</body><</html>
|
||||
""" % ( FileBrowseButton.__doc__,
|
||||
FileBrowseButtonWithHistory.__doc__ ,
|
||||
str(DirBrowseButton.__doc__) )
|
||||
|
140
wxPython/demo/LayoutAnchors.py
Normal file
140
wxPython/demo/LayoutAnchors.py
Normal file
@@ -0,0 +1,140 @@
|
||||
|
||||
from wxPython.wx import *
|
||||
from wxPython.lib.anchors import LayoutAnchors
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
|
||||
[wxID_ANCHORSDEMOFRAMEANCHOREDPANEL, wxID_ANCHORSDEMOFRAMEHELPSTATICTEXT,
|
||||
wxID_ANCHORSDEMOFRAMEMAINPANEL, wxID_ANCHORSDEMOFRAMEBACKGROUNDPANEL,
|
||||
wxID_ANCHORSDEMOFRAMERIGHTCHECKBOX, wxID_ANCHORSDEMOFRAMEOKBUTTON,
|
||||
wxID_ANCHORSDEMOFRAMETOPCHECKBOX, wxID_ANCHORSDEMOFRAMEBOTTOMCHECKBOX,
|
||||
wxID_ANCHORSDEMOFRAME, wxID_ANCHORSDEMOFRAMELEFTCHECKBOX,
|
||||
] = map(lambda _init_ctrls: wxNewId(), range(10))
|
||||
|
||||
class AnchorsDemoFrame(wxFrame):
|
||||
def _init_utils(self):
|
||||
pass
|
||||
|
||||
def _init_ctrls(self, prnt):
|
||||
wxFrame.__init__(self, size = wxSize(328, 187), id = wxID_ANCHORSDEMOFRAME, title = 'LayoutAnchors Demonstration', parent = prnt, name = 'AnchorsDemoFrame', style = wxDEFAULT_FRAME_STYLE | wxCLIP_CHILDREN, pos = wxPoint(261, 123))
|
||||
self._init_utils()
|
||||
|
||||
self.mainPanel = wxPanel(size = wxSize(320, 160), parent = self, id = wxID_ANCHORSDEMOFRAMEMAINPANEL, name = 'panel1', style = wxTAB_TRAVERSAL | wxCLIP_CHILDREN, pos = wxPoint(0, 0))
|
||||
self.mainPanel.SetAutoLayout(true)
|
||||
|
||||
self.okButton = wxButton(label = 'OK', id = wxID_ANCHORSDEMOFRAMEOKBUTTON, parent = self.mainPanel, name = 'okButton', size = wxSize(72, 24), style = 0, pos = wxPoint(240, 128))
|
||||
self.okButton.SetConstraints(LayoutAnchors(self.okButton, false, false, true, true))
|
||||
EVT_BUTTON(self.okButton, wxID_ANCHORSDEMOFRAMEOKBUTTON, self.OnOkButtonButton)
|
||||
|
||||
self.backgroundPanel = wxPanel(size = wxSize(304, 80), parent = self.mainPanel, id = wxID_ANCHORSDEMOFRAMEBACKGROUNDPANEL, name = 'backgroundPanel', style = wxSIMPLE_BORDER | wxCLIP_CHILDREN, pos = wxPoint(8, 40))
|
||||
self.backgroundPanel.SetBackgroundColour(wxColour(255, 255, 255))
|
||||
self.backgroundPanel.SetConstraints(LayoutAnchors(self.backgroundPanel, true, true, true, true))
|
||||
|
||||
self.anchoredPanel = wxPanel(size = wxSize(88, 48), id = wxID_ANCHORSDEMOFRAMEANCHOREDPANEL, parent = self.backgroundPanel, name = 'anchoredPanel', style = wxSIMPLE_BORDER, pos = wxPoint(104, 16))
|
||||
self.anchoredPanel.SetBackgroundColour(wxColour(0, 0, 222))
|
||||
self.anchoredPanel.SetConstraints(LayoutAnchors(self.anchoredPanel, false, false, false, false))
|
||||
|
||||
self.leftCheckBox = wxCheckBox(label = 'Left', id = wxID_ANCHORSDEMOFRAMELEFTCHECKBOX, parent = self.mainPanel, name = 'leftCheckBox', size = wxSize(40, 16), style = 0, pos = wxPoint(8, 8))
|
||||
self.leftCheckBox.SetConstraints(LayoutAnchors(self.leftCheckBox, false, true, false, false))
|
||||
EVT_CHECKBOX(self.leftCheckBox, wxID_ANCHORSDEMOFRAMELEFTCHECKBOX, self.OnCheckboxCheckbox)
|
||||
|
||||
self.topCheckBox = wxCheckBox(label = 'Top', id = wxID_ANCHORSDEMOFRAMETOPCHECKBOX, parent = self.mainPanel, name = 'topCheckBox', size = wxSize(40, 16), style = 0, pos = wxPoint(88, 8))
|
||||
self.topCheckBox.SetConstraints(LayoutAnchors(self.topCheckBox, false, true, false, false))
|
||||
EVT_CHECKBOX(self.topCheckBox, wxID_ANCHORSDEMOFRAMETOPCHECKBOX, self.OnCheckboxCheckbox)
|
||||
|
||||
self.rightCheckBox = wxCheckBox(label = 'Right', id = wxID_ANCHORSDEMOFRAMERIGHTCHECKBOX, parent = self.mainPanel, name = 'rightCheckBox', size = wxSize(48, 16), style = 0, pos = wxPoint(168, 8))
|
||||
self.rightCheckBox.SetConstraints(LayoutAnchors(self.rightCheckBox, false, true, false, false))
|
||||
EVT_CHECKBOX(self.rightCheckBox, wxID_ANCHORSDEMOFRAMERIGHTCHECKBOX, self.OnCheckboxCheckbox)
|
||||
|
||||
self.bottomCheckBox = wxCheckBox(label = 'Bottom', id = wxID_ANCHORSDEMOFRAMEBOTTOMCHECKBOX, parent = self.mainPanel, name = 'bottomCheckBox', size = wxSize(56, 16), style = 0, pos = wxPoint(248, 8))
|
||||
self.bottomCheckBox.SetConstraints(LayoutAnchors(self.bottomCheckBox, false, true, false, false))
|
||||
EVT_CHECKBOX(self.bottomCheckBox, wxID_ANCHORSDEMOFRAMEBOTTOMCHECKBOX, self.OnCheckboxCheckbox)
|
||||
|
||||
self.helpStaticText = wxStaticText(label = 'Select anchor options above, then resize window to see the effect', id = wxID_ANCHORSDEMOFRAMEHELPSTATICTEXT, parent = self.mainPanel, name = 'helpStaticText', size = wxSize(224, 24), style = wxST_NO_AUTORESIZE, pos = wxPoint(8, 128))
|
||||
self.helpStaticText.SetConstraints(LayoutAnchors(self.helpStaticText, true, false, true, true))
|
||||
|
||||
def __init__(self, parent):
|
||||
self._init_ctrls(parent)
|
||||
|
||||
def OnCheckboxCheckbox(self, event):
|
||||
self.anchoredPanel.SetConstraints(
|
||||
LayoutAnchors(self.anchoredPanel,
|
||||
self.leftCheckBox.GetValue(), self.topCheckBox.GetValue(),
|
||||
self.rightCheckBox.GetValue(), self.bottomCheckBox.GetValue()) )
|
||||
|
||||
def OnOkButtonButton(self, event):
|
||||
self.Close()
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
def runTest(frame, nb, log):
|
||||
win = AnchorsDemoFrame(frame)
|
||||
frame.otherWin = win
|
||||
win.Show(true)
|
||||
|
||||
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
overview = """<html><body>
|
||||
<h2>LayoutAnchors</h2>
|
||||
A class that implements Delphi's Anchors with wxLayoutConstraints.
|
||||
<p>
|
||||
Anchored sides maintain the distance from the edge of the
|
||||
control to the same edge of the parent.
|
||||
When neither side is selected, the control keeps the same
|
||||
relative position to both sides.
|
||||
<p>
|
||||
The current position and size of the control and it's parent
|
||||
is used when setting up the constraints. To change the size or
|
||||
position of an already anchored control, set the constraints to
|
||||
None, reposition or resize and reapply the anchors.
|
||||
<p>
|
||||
Examples:
|
||||
<p>
|
||||
Let's anchor the right and bottom edge of a control and
|
||||
resize it's parent.
|
||||
<p>
|
||||
<pre>
|
||||
ctrl.SetConstraints(LayoutAnchors(ctrl, left=0, top=0, right=1, bottom=1))
|
||||
|
||||
+=========+ +===================+
|
||||
| +-----+ | | |
|
||||
| | * | -> | |
|
||||
| +--*--+ | | +-----+ |
|
||||
+---------+ | | * |
|
||||
| +--*--+ |
|
||||
+-------------------+
|
||||
* = anchored edge
|
||||
</pre>
|
||||
<p>
|
||||
When anchored on both sides the control will stretch horizontally.
|
||||
<p>
|
||||
<pre>
|
||||
ctrl.SetConstraints(LayoutAnchors(ctrl, 1, 0, 1, 1))
|
||||
|
||||
+=========+ +===================+
|
||||
| +-----+ | | |
|
||||
| * * | -> | |
|
||||
| +--*--+ | | +---------------+ |
|
||||
+---------+ | * ctrl * |
|
||||
| +-------*-------+ |
|
||||
+-------------------+
|
||||
* = anchored edge
|
||||
</pre>
|
||||
</html></body>
|
||||
"""
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -20,7 +20,7 @@ from wxPython.html import wxHtmlWindow
|
||||
|
||||
|
||||
_treeList = [
|
||||
('New since last release', ['wxProcess',
|
||||
('New since last release', ['LayoutAnchors', "FancyText",
|
||||
]),
|
||||
|
||||
('Managed Windows', ['wxFrame', 'wxDialog', 'wxMiniFrame']),
|
||||
@@ -43,14 +43,14 @@ _treeList = [
|
||||
'wxCalendarCtrl',
|
||||
]),
|
||||
|
||||
('Window Layout', ['wxLayoutConstraints', 'Sizers', ]),
|
||||
('Window Layout', ['wxLayoutConstraints', 'LayoutAnchors', 'Sizers', ]),
|
||||
|
||||
('Miscellaneous', [ 'DragAndDrop', 'CustomDragAndDrop', 'FontEnumerator',
|
||||
'wxTimer', 'wxValidator', 'wxGLCanvas', 'DialogUnits',
|
||||
'wxImage', 'wxMask', 'PrintFramework', 'wxOGL',
|
||||
'PythonEvents', 'Threads',
|
||||
'ActiveXWrapper_Acrobat', 'ActiveXWrapper_IE',
|
||||
'wxDragImage',
|
||||
'wxDragImage', "wxProcess", "FancyText",
|
||||
]),
|
||||
|
||||
('wxPython Library', ['Layoutf', 'wxScrolledMessageDialog',
|
||||
|
BIN
wxPython/demo/bitmaps/robin.jpg
Normal file
BIN
wxPython/demo/bitmaps/robin.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.7 KiB |
Binary file not shown.
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
BIN
wxPython/demo/data/pic2.gif
Normal file
BIN
wxPython/demo/data/pic2.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.0 KiB |
@@ -57,6 +57,10 @@ display some tiny nice image</TT>, he?</FONT>
|
||||
this is text......
|
||||
<BR><A HREF="pic.png"><IMG SRC="pic.png" ALT="Testing image image" HEIGHT=160 WIDTH=100 ALIGN=TEXTTOP></A> (try clicking on the image :-) and
|
||||
this is text......
|
||||
|
||||
<br>
|
||||
Here is a GIF: <IMG SRC="pic2.gif">
|
||||
|
||||
<BR>
|
||||
<BR>
|
||||
<UL>
|
||||
|
@@ -15,8 +15,8 @@ class TestChoice(wxPanel):
|
||||
wxPoint(15, 10))
|
||||
|
||||
wxStaticText(self, -1, "Select one:", wxPoint(15, 50), wxSize(75, 20))
|
||||
wxChoice(self, 40, wxPoint(80, 50), wxSize(95, 20), #wxDefaultSize,
|
||||
sampleList)
|
||||
wxChoice(self, 40, (80, 50), (95, 125),
|
||||
choices = sampleList)
|
||||
EVT_CHOICE(self, 40, self.EvtChoice)
|
||||
|
||||
def EvtChoice(self, event):
|
||||
|
@@ -4,9 +4,8 @@ from wxPython.wx import *
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
def runTest(frame, nb, log):
|
||||
data = wxColourData()
|
||||
data.SetChooseFull(true)
|
||||
dlg = wxColourDialog(frame, data)
|
||||
dlg = wxColourDialog(frame)
|
||||
dlg.GetColourData().SetChooseFull(true)
|
||||
if dlg.ShowModal() == wxID_OK:
|
||||
data = dlg.GetColourData()
|
||||
log.WriteText('You selected: %s\n' % str(data.GetColour().Get()))
|
||||
|
@@ -66,7 +66,7 @@ class TestListBox(wxPanel):
|
||||
EVT_LISTBOX(self, 60, self.EvtListBox)
|
||||
EVT_LISTBOX_DCLICK(self, 60, self.EvtListBoxDClick)
|
||||
EVT_RIGHT_UP(self.lb1, self.EvtRightButton)
|
||||
self.lb1.SetSelection(0)
|
||||
self.lb1.SetSelection(3)
|
||||
|
||||
|
||||
wxStaticText(self, -1, "Select many:", wxPoint(200, 50), wxSize(65, 18))
|
||||
|
@@ -15,7 +15,7 @@ class TestSashWindow(wxPanel):
|
||||
|
||||
self.log = log
|
||||
|
||||
# will accupy the space not uised by the Layout Algorithm
|
||||
# will occupy the space not used by the Layout Algorithm
|
||||
self.remainingSpace = wxPanel(self, -1, style=wxSUNKEN_BORDER)
|
||||
|
||||
EVT_SASH_DRAGGED_RANGE(self, self.ID_WINDOW_TOP,
|
||||
|
@@ -14,10 +14,16 @@ class TestPanel(wxPanel):
|
||||
wxStaticText(self, -1, "This is a wxStaticBitmap.", wxPoint(45, 15))
|
||||
|
||||
bmp = wxBitmap('bitmaps/test2.bmp', wxBITMAP_TYPE_BMP)
|
||||
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)
|
||||
wxStaticBitmap(self, -1, bmp, (80, 150))
|
||||
|
||||
wxStaticText(self, -1, "Hey, if Ousterhout can do it, so can I.",
|
||||
(200, 175))
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
@@ -26,25 +26,5 @@ def runTest(frame, nb, log):
|
||||
|
||||
|
||||
overview = """\
|
||||
This class represents a dialog that requests a one-line text string from the user. It is implemented as a generic wxWindows dialog.
|
||||
|
||||
wxTextEntryDialog()
|
||||
----------------------------------
|
||||
|
||||
wxTextEntryDialog(wxWindow* parent, const wxString& message, const wxString& caption = "Please enter text", const wxString& defaultValue = "", long style = wxOK | wxCANCEL | wxCENTRE, const wxPoint& pos = wxDefaultPosition)
|
||||
|
||||
Constructor. Use wxTextEntryDialog::ShowModal to show the dialog.
|
||||
|
||||
Parameters
|
||||
-------------------
|
||||
|
||||
parent = Parent window.
|
||||
|
||||
message = Message to show on the dialog.
|
||||
|
||||
defaultValue = The default value, which may be the empty string.
|
||||
|
||||
style = A dialog style, specifying the buttons (wxOK, wxCANCEL) and an optional wxCENTRE style.
|
||||
|
||||
pos = Dialog position.
|
||||
"""
|
||||
|
@@ -13,7 +13,7 @@ class TestToolBar(wxFrame):
|
||||
|
||||
wxWindow(self, -1).SetBackgroundColour(wxNamedColour("WHITE"))
|
||||
|
||||
tb = self.CreateToolBar(wxTB_HORIZONTAL|wxNO_BORDER) #|wxTB_FLAT)
|
||||
tb = self.CreateToolBar(wxTB_HORIZONTAL|wxNO_BORDER|wxTB_FLAT)
|
||||
#tb = wxToolBarSimple(self, -1, wxDefaultPosition, wxDefaultSize,
|
||||
# wxTB_HORIZONTAL | wxNO_BORDER | wxTB_FLAT)
|
||||
#self.SetToolBar(tb)
|
||||
|
Reference in New Issue
Block a user