2003-12-08 20:23:28 -05:00
|
|
|
|
|
|
|
import wx
|
2003-12-20 14:36:30 -05:00
|
|
|
import wx.lib.dialogs
|
1999-04-29 23:29:54 -04:00
|
|
|
|
|
|
|
#---------------------------------------------------------------------------
|
|
|
|
|
2004-08-09 21:21:16 -04:00
|
|
|
class TestPanel(wx.Panel):
|
|
|
|
def __init__(self, parent, log):
|
|
|
|
self.log = log
|
|
|
|
wx.Panel.__init__(self, parent, -1)
|
|
|
|
|
|
|
|
b = wx.Button(self, -1, "Create and Show a MultipleChoiceDialog", (50,50))
|
|
|
|
self.Bind(wx.EVT_BUTTON, self.OnButton, b)
|
|
|
|
|
|
|
|
|
|
|
|
def OnButton(self, evt):
|
|
|
|
lst = [ 'apple', 'pear', 'banana', 'coconut', 'orange', 'grape', 'pineapple',
|
|
|
|
'blueberry', 'raspberry', 'blackberry', 'snozzleberry',
|
|
|
|
'etc', 'etc..', 'etc...' ]
|
|
|
|
|
|
|
|
dlg = wx.lib.dialogs.MultipleChoiceDialog(
|
|
|
|
self,
|
|
|
|
"Pick some from\n this list\nblah blah...",
|
|
|
|
"m.s.d.", lst)
|
2003-12-08 20:23:28 -05:00
|
|
|
|
2004-08-09 21:21:16 -04:00
|
|
|
if (dlg.ShowModal() == wx.ID_OK):
|
|
|
|
self.log.write("Selection: %s -> %s\n" % (dlg.GetValue(), dlg.GetValueString()))
|
2003-12-08 20:23:28 -05:00
|
|
|
|
2004-08-09 21:21:16 -04:00
|
|
|
dlg.Destroy()
|
2004-03-15 18:08:27 -05:00
|
|
|
|
2004-08-09 21:21:16 -04:00
|
|
|
|
|
|
|
|
|
|
|
#---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
def runTest(frame, nb, log):
|
|
|
|
win = TestPanel(nb, log)
|
|
|
|
return win
|
1999-04-29 23:29:54 -04:00
|
|
|
|
|
|
|
#---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
overview = """\
|
|
|
|
<html>
|
|
|
|
<body>
|
1999-04-29 23:29:54 -04:00
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
This is a Python implementation of a dialog that is not yet implemented in wxWindows
|
|
|
|
proper, so don't let the wxWindows documentation mislead you.
|
1999-04-29 23:29:54 -04:00
|
|
|
|
2003-12-20 14:36:30 -05:00
|
|
|
<p><code><b>MultipleChoiceDialog</b>(self, parent, msg, title, lst,
|
2004-01-12 22:17:17 -05:00
|
|
|
pos = wx.wxDefaultPosition, size = (200,200), style = wx.DEFAULT_DIALOG_STYLE)
|
2003-12-08 20:23:28 -05:00
|
|
|
</code>
|
1999-04-29 23:29:54 -04:00
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
<dl>
|
|
|
|
<dt><code>parent</code>
|
|
|
|
<dd>The parent window
|
1999-04-29 23:29:54 -04:00
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
<dt><code>msg</code>
|
|
|
|
<dd>The message that will be displayed above the list
|
1999-04-29 23:29:54 -04:00
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
<dt><code>title</code>
|
|
|
|
<dd>The text that will appear on the title bar
|
1999-04-29 23:29:54 -04:00
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
<dt><code>lst</code>
|
|
|
|
<dd>A Python list of choices that will appear in the dialog.
|
|
|
|
|
|
|
|
<dt><code>pos</code>
|
|
|
|
<dd>The position of the dialog
|
2003-07-02 19:13:10 -04:00
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
<dt><code>size</code>
|
|
|
|
<dd>The size of the dialog
|
2003-07-02 19:13:10 -04:00
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
<dt><code>style</code>
|
|
|
|
<dd>The style for the dialog. Only styles normally available to wxDialog are
|
|
|
|
available.
|
2003-07-02 19:13:10 -04:00
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
</dl>
|
2003-07-02 19:13:10 -04:00
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
<b><font size=+1><code>Methods</code></font></b>
|
|
|
|
|
|
|
|
<dl>
|
|
|
|
<dt><code>GetValue</code>
|
|
|
|
<dd>Returns a tuple containing the indices of the selected items
|
|
|
|
|
|
|
|
<dt><code>GetValueString</code>
|
|
|
|
<dd>Returns a tuple containing the text of the selected items
|
|
|
|
|
|
|
|
</dl>
|
|
|
|
|
2003-12-20 14:36:30 -05:00
|
|
|
Additionally, MultipleChoiceDialog.lbox is a standard wx.ListBox which supports all
|
2003-12-08 20:23:28 -05:00
|
|
|
methods applicable to that class.
|
|
|
|
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
"""
|
2003-07-02 19:13:10 -04:00
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
import sys,os
|
|
|
|
import run
|
2004-03-04 19:06:33 -05:00
|
|
|
run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])
|