This commit was manufactured by cvs2svn to create tag 'wxPy_2_6_4_0'.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/tags/wxPy_2_6_4_0@44989 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Bryan Petty
2007-03-20 20:36:57 +00:00
parent 219ee9ba9d
commit 2c6b0ab87d
2304 changed files with 240793 additions and 262981 deletions

View File

@@ -30,7 +30,7 @@ sit back and enjoy. Be sure to take a peek at the source code for each
demo item so you can learn how to use the classes yourself.</p>
<p><b>wxPython</b> is brought to you by <b>Robin Dunn</b> and<br>
<b>Total Control Software,</b> Copyright (c) 1997-2005.</p>
<b>Total Control Software,</b> Copyright (c) 1997-2006.</p>
<p>
<font size="-1">Please see <i>license.txt</i> for licensing information.</font>

View File

@@ -10,55 +10,150 @@ if wx.Platform == '__WXMSW__':
class TestPanel(wx.Panel):
def __init__(self, parent, log):
wx.Panel.__init__(self, parent, -1)
self.pdf = None
sizer = wx.BoxSizer(wx.VERTICAL)
btnSizer = wx.BoxSizer(wx.HORIZONTAL)
mainsizer = wx.BoxSizer(wx.HORIZONTAL)
leftsizer = wx.BoxSizer(wx.VERTICAL)
self.pdf = PDFWindow(self, style=wx.SUNKEN_BORDER)
leftsizer.Add(self.pdf, proportion=1, flag=wx.EXPAND)
sizer.Add(self.pdf, proportion=1, flag=wx.EXPAND)
box = wx.StaticBox(self, wx.NewId(), "" )
buttonsizer = wx.StaticBoxSizer(box, wx.HORIZONTAL )
b1 = wx.Button(self, wx.NewId(), "First")
buttonsizer.Add(b1, proportion=0, flag=wx.ALIGN_CENTER|wx.ALL, border=5)
self.Bind(wx.EVT_BUTTON, self.OnFirstPageButton, b1)
btn = wx.Button(self, wx.NewId(), "Open PDF File")
self.Bind(wx.EVT_BUTTON, self.OnOpenButton, btn)
btnSizer.Add(btn, proportion=1, flag=wx.EXPAND|wx.ALL, border=5)
b2 = wx.Button(self, wx.NewId(), "Previous")
buttonsizer.Add(b2, proportion=0, flag=wx.ALIGN_CENTER|wx.ALL, border=5)
self.Bind(wx.EVT_BUTTON, self.OnPreviousPageButton, b2)
tx1 = wx.StaticText(self, wx.NewId(), " Go to page" )
buttonsizer.Add(tx1, proportion=0, flag=wx.ALIGN_CENTER|wx.ALL, border=5)
tc1 = wx.TextCtrl(self, wx.NewId(), "0", size=[30,-1])
buttonsizer.Add( tc1, proportion=0, flag=wx.ALIGN_CENTER|wx.ALL, border=5)
self.Bind(wx.EVT_TEXT, self.OnGotoPage, tc1)
b3 = wx.Button(self, wx.NewId(), "Next")
buttonsizer.Add(b3, proportion=0, flag=wx.ALIGN_CENTER|wx.ALL, border=5)
self.Bind(wx.EVT_BUTTON, self.OnNextPageButton, b3)
btn = wx.Button(self, wx.NewId(), "<-- Previous Page")
self.Bind(wx.EVT_BUTTON, self.OnPrevPageButton, btn)
btnSizer.Add(btn, proportion=1, flag=wx.EXPAND|wx.ALL, border=5)
b4 = wx.Button(self, wx.NewId(), "Last")
buttonsizer.Add(b4, proportion=0, flag=wx.ALIGN_CENTER|wx.ALL, border=5)
self.Bind(wx.EVT_BUTTON, self.OnLastPageButton, b4)
btn = wx.Button(self, wx.NewId(), "Next Page -->")
self.Bind(wx.EVT_BUTTON, self.OnNextPageButton, btn)
btnSizer.Add(btn, proportion=1, flag=wx.EXPAND|wx.ALL, border=5)
tx2 = wx.StaticText(self, wx.NewId(), " Zoom")
buttonsizer.Add(tx2, proportion=0, flag=wx.ALIGN_CENTER|wx.ALL, border=5)
ch1 = wx.Choice(self, wx.NewId(),
choices=["Default", "Fit", "FitH", "FitV",
"25%", "50%", "75%", "100%", "125%", "200%", "400%"])
ch1.SetSelection(0)
buttonsizer.Add(ch1, proportion=0, flag=wx.ALIGN_CENTER|wx.ALL, border=5)
self.Bind(wx.EVT_CHOICE, self.OnZoom, ch1)
leftsizer.Add(buttonsizer, proportion=0)
mainsizer.Add(leftsizer, proportion=1, flag=wx.GROW|wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, border=5)
btnSizer.Add((50,-1), proportion=2, flag=wx.EXPAND)
sizer.Add(btnSizer, proportion=0, flag=wx.EXPAND)
box = wx.StaticBox(self, wx.NewId(), "" )
rightsizer = wx.StaticBoxSizer(box, wx.VERTICAL)
b5 = wx.Button(self, wx.NewId(), "Load PDF")
rightsizer.Add(b5, proportion=0, flag=wx.ALIGN_CENTER_VERTICAL|wx.ALL, border=5)
self.Bind(wx.EVT_BUTTON, self.OnLoadButton, b5)
self.SetSizer(sizer)
b6 = wx.Button(self, wx.NewId(), "Print")
rightsizer.Add(b6, proportion=0, flag=wx.ALIGN_CENTER_VERTICAL|wx.ALL, border=5)
self.Bind(wx.EVT_BUTTON, self.OnPrintButton, b6)
tx3 = wx.StaticText(self, wx.NewId(), "Page mode:")
rightsizer.Add(tx3, proportion=0, flag=wx.ALIGN_CENTER_VERTICAL|wx.ALL, border=5)
ch2 = wx.Choice(self, wx.NewId(),size=[100,-1],
choices=["None", "Bookmarks", "Thumbs"])
ch2.SetSelection(0)
rightsizer.Add(ch2, proportion=0, flag=wx.ALIGN_CENTER_VERTICAL|wx.ALL, border=5)
self.Bind(wx.EVT_CHOICE, self.OnPageMode, ch2)
tx4 = wx.StaticText(self, wx.NewId(), "Layout mode:")
rightsizer.Add(tx4, proportion=0, flag=wx.ALIGN_CENTER_VERTICAL|wx.ALL, border=5)
ch3 = wx.Choice(self, wx.NewId(),size=[100,-1],
choices=["DontCare", "SinglePage",
"OneColumn", "TwoColumnLeft", "TwoColumnRight" ])
ch3.SetSelection(0)
rightsizer.Add(ch3, proportion=0, flag=wx.ALIGN_CENTER_VERTICAL|wx.ALL, border=5)
self.Bind(wx.EVT_CHOICE, self.OnLayoutMode, ch3)
cx1 = wx.CheckBox(self, wx.NewId(), "Toolbar")
cx1.SetValue( True )
rightsizer.Add( cx1,proportion=0, flag=wx.ALIGN_CENTER_VERTICAL|wx.ALL, border=5)
self.Bind(wx.EVT_CHECKBOX, self.OnToolbar, cx1)
cx2 = wx.CheckBox(self, wx.NewId(), "Scrollbars")
cx2.SetValue( True )
rightsizer.Add( cx2,proportion=0, flag=wx.ALIGN_CENTER_VERTICAL|wx.ALL, border=5)
self.Bind(wx.EVT_CHECKBOX, self.OnScrollbars, cx2)
mainsizer.Add( rightsizer, proportion=0, flag=wx.ALL, border=15)
self.SetSizer(mainsizer)
self.SetAutoLayout(True)
def OnFirstPageButton(self, event):
self.pdf.gotoFirstPage()
def OnOpenButton(self, event):
dlg = wx.FileDialog(self, wildcard="*.pdf")
if dlg.ShowModal() == wx.ID_OK:
wx.BeginBusyCursor()
self.pdf.LoadFile(dlg.GetPath())
wx.EndBusyCursor()
dlg.Destroy()
def OnPrevPageButton(self, event):
def OnPreviousPageButton(self, event):
self.pdf.gotoPreviousPage()
def OnNextPageButton(self, event):
self.pdf.gotoNextPage()
def OnLastPageButton(self, event):
self.pdf.gotoLastPage()
def OnGotoPage(self, event):
npage = event.GetEventObject().GetValue()
try:
self.pdf.setCurrentPage(int(npage))
except ValueError:
pass
def OnZoom(self, event):
astring = event.GetEventObject().GetStringSelection()
if astring.startswith('Fit'):
self.pdf.setView(astring)
else:
try:
percent = float(astring.replace('%',''))
self.pdf.setZoom(percent)
except ValueError:
pass
def OnLoadButton(self, event):
dlg = wx.FileDialog(self, wildcard="*.pdf")
if dlg.ShowModal() == wx.ID_OK:
wx.BeginBusyCursor()
self.pdf.LoadFile(dlg.GetPath())
wx.EndBusyCursor()
dlg.Destroy()
def OnPrintButton(self, event):
self.pdf.Print()
def OnPageMode(self, event):
astring = event.GetEventObject().GetStringSelection()
self.pdf.setPageMode(astring.lower())
def OnLayoutMode(self, event):
astring = event.GetEventObject().GetStringSelection()
self.pdf.setLayoutMode(astring)
def OnToolbar(self, event):
on = event.GetEventObject().GetValue()
self.pdf.setShowToolbar(on)
def OnScrollbars(self, event):
on = event.GetEventObject().GetValue()
self.pdf.setShowScrollbars(on)
#----------------------------------------------------------------------

View File

@@ -0,0 +1,139 @@
# AnalogClock demo
# E. A. Tacao <e.a.tacao |at| estadao.com.br>
# http://j.domaindlx.com/elements28/wxpython/
# 12 Fev 2006, 22:00 GMT-03:00
# Distributed under the wxWidgets license.
import wx
import wx.lib.analogclock as ac
#----------------------------------------------------------------------
class TestPanel(wx.Panel):
def __init__(self, parent, log):
self.log = log
wx.Panel.__init__(self, parent)
# A mostly default clock
c1 = ac.AnalogClock(self)
# A plain clock, with square hour and round minute marks, no
# shadow, static border
c2 = ac.AnalogClock(self, style=wx.STATIC_BORDER,
hoursStyle=ac.TICKS_SQUARE,
minutesStyle=ac.TICKS_CIRCLE,
clockStyle=ac.SHOW_HOURS_TICKS| \
ac.SHOW_MINUTES_TICKS|
ac.SHOW_HOURS_HAND| \
ac.SHOW_MINUTES_HAND| \
ac.SHOW_SECONDS_HAND)
c2.SetTickSize(12, target=ac.HOUR)
# No minute tick marks
c3 = ac.AnalogClock(self, hoursStyle=ac.TICKS_CIRCLE,
clockStyle=ac.SHOW_HOURS_TICKS| \
ac.SHOW_HOURS_HAND| \
ac.SHOW_MINUTES_HAND| \
ac.SHOW_SECONDS_HAND| \
ac.SHOW_SHADOWS)
c3.SetTickSize(12)
# A clock with hex numbers no seconds hand and different colours.
c4 = ac.AnalogClock(self, hoursStyle=ac.TICKS_HEX,
clockStyle=ac.SHOW_HOURS_TICKS| \
ac.SHOW_HOURS_HAND| \
ac.SHOW_MINUTES_HAND| \
ac.SHOW_SHADOWS)
colour = wx.Colour(0, 255, 255)
c4.SetForegroundColour(colour)
colour = wx.Colour(0, 132, 132)
c4.SetShadowColour(colour)
c4.SetTickFont(wx.Font(10, wx.FONTFAMILY_MODERN, wx.NORMAL, wx.BOLD))
c4.SetBackgroundColour(wx.BLACK)
c4.SetFaceBorderColour(wx.BLACK)
c4.SetFaceFillColour(wx.BLACK)
# A clock with binary numbers shown only at the quarter tick marks,
# no minutes ticks and different colours.
c5 = ac.AnalogClock(self, style = wx.RAISED_BORDER,
hoursStyle=ac.TICKS_BINARY,
clockStyle=ac.SHOW_QUARTERS_TICKS| \
ac.SHOW_HOURS_HAND| \
ac.SHOW_MINUTES_HAND| \
ac.SHOW_SECONDS_HAND| \
ac.SHOW_SHADOWS)
colour = wx.Colour(0, 128, 0)
c5.SetHandFillColour(colour, target=ac.SECOND)
c5.SetHandBorderColour(colour, target=ac.SECOND)
c5.SetBackgroundColour(colour)
colour = wx.Colour(128, 0, 64)
c5.SetTickFillColour(colour)
c5.SetFaceBorderColour(colour)
c5.SetFaceBorderWidth(1)
colour = wx.Colour(0, 198, 0)
c5.SetFaceFillColour(colour)
c5.SetShadowColour(wx.WHITE)
# A clock with a sunken border, roman numerals shown only at the
# quarter tick marks with a roman font, circular minutes ticks,
# no seconds hand, no shadows, tick overlapping and different colours.
c6 = ac.AnalogClock(self, style = wx.SUNKEN_BORDER,
hoursStyle=ac.TICKS_ROMAN,
minutesStyle=ac.TICKS_CIRCLE,
clockStyle=ac.SHOW_QUARTERS_TICKS| \
ac.SHOW_MINUTES_TICKS| \
ac.SHOW_HOURS_HAND| \
ac.SHOW_MINUTES_HAND| \
ac.OVERLAP_TICKS)
colour = wx.Colour(128, 0, 0)
c6.SetHandFillColour(colour)
colour = wx.Colour(179, 0, 89)
c6.SetHandBorderColour(colour)
c6.SetTickFillColour(colour)
c6.SetTickBorderColour(colour)
colour = wx.Colour(225, 255, 255)
c6.SetFaceBorderColour(colour)
c6.SetBackgroundColour(colour)
colour = wx.Colour(249, 255, 255)
c6.SetFaceFillColour(colour)
colour = wx.Colour(255, 213, 213)
c6.SetShadowColour(colour)
c6.SetTickFont(wx.Font(10, wx.FONTFAMILY_ROMAN, wx.NORMAL, wx.BOLD))
# layout the clocks in a grid
gs = wx.GridSizer(2, 3, 4, 4)
gs.Add(c1, 0, wx.EXPAND)
gs.Add(c2, 0, wx.EXPAND)
gs.Add(c3, 0, wx.EXPAND)
gs.Add(c4, 0, wx.EXPAND)
gs.Add(c5, 0, wx.EXPAND)
gs.Add(c6, 0, wx.EXPAND)
# put it in another sizer for a border
sizer = wx.BoxSizer(wx.VERTICAL)
sizer.Add(gs, 1, wx.EXPAND|wx.ALL, 10)
self.SetSizerAndFit(sizer)
#----------------------------------------------------------------------
def runTest(frame, nb, log):
win = TestPanel(nb, log)
return win
#----------------------------------------------------------------------
overview = """<html>
<PRE><FONT SIZE=-1>
""" + ac.__doc__.replace("<", "").replace(">", "") + """
</FONT></PRE>"""
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])

View File

@@ -1,106 +0,0 @@
import wx
from wx.lib import analogclock as ac
#----------------------------------------------------------------------
class TestPanel(wx.Panel):
def __init__(self, parent, log):
self.log = log
wx.Panel.__init__(self, parent, -1)
# A mostly default clock
c1 = ac.AnalogClockWindow(self)
c1.SetBackgroundColour("RED")
c1.SetHandColours("BLUE")
c1.SetTickColours("WHITE")
c1.SetTickSizes(h=5, m=2)
# A clock with roman numerals, shown only at the quarter
# marks, and a separatly coloured watch face.
c2 = ac.AnalogClockWindow(self)
c2.SetBackgroundColour("WHITE")
c2.SetHandColours("RED")
c2.SetTickColours("BLUE")
c2.SetTickStyles(ac.TICKS_ROMAN)
c2.SetClockStyle(ac.SHOW_QUARTERS_TICKS | ac.SHOW_SHADOWS)
c2.SetWatchPenBrush(p=wx.Pen((238, 238, 227), 1, wx.SOLID),
b=wx.Brush("CADET BLUE", wx.SOLID))
c2.SetTickSizes(h=12)
# A clock with rotated decimal numbers, shown at all twelve
# hour marks
c3 = ac.AnalogClockWindow(self)
c3.SetBackgroundColour("BLUE")
c3.SetHandColours("WHITE")
c3.SetTickColours("RED")
c3.SetTickStyles(h=ac.TICKS_DECIMAL)
c3.SetClockStyle(ac.SHOW_HOURS_TICKS | ac.ROTATE_TICKS)
c3.SetTickSizes(h=14)
# a plain clock, with square hour and round minute marks, no
# shadow raised border
c4 = ac.AnalogClockWindow(self, style=wx.RAISED_BORDER)
c4.SetTickStyles(h=ac.TICKS_SQUARE, m=ac.TICKS_CIRCLE)
c4.SetClockStyle(ac.SHOW_HOURS_TICKS | ac.SHOW_MINUTES_TICKS)
c4.SetTickSizes(h=5, m=2)
# no minute tick marks
c5 = ac.AnalogClockWindow(self)
c5.SetTickStyles(h=ac.TICKS_CIRCLE)
c5.SetClockStyle(ac.SHOW_HOURS_TICKS | ac.SHOW_SHADOWS | ac.ROTATE_TICKS)
c5.SetTickSizes(h=5, m=2)
# sunken border
c6 = ac.AnalogClockWindow(self, style=wx.SUNKEN_BORDER)
c6.SetTickSizes(h=5, m=2)
# layout the clocks in a grid
gs = wx.GridSizer(2, 3, 4, 4)
gs.Add(c1, 0, wx.EXPAND)
gs.Add(c2, 0, wx.EXPAND)
gs.Add(c3, 0, wx.EXPAND)
gs.Add(c4, 0, wx.EXPAND)
gs.Add(c5, 0, wx.EXPAND)
gs.Add(c6, 0, wx.EXPAND)
# put it in another sizer for a border
sizer = wx.BoxSizer(wx.VERTICAL)
sizer.Add(gs, 1, wx.EXPAND | wx.ALL, 10)
self.SetSizer(sizer)
#----------------------------------------------------------------------
def runTest(frame, nb, log):
win = TestPanel(nb, log)
return win
#----------------------------------------------------------------------
overview = """<html><body>
<h2><center>AnalogClockWindow</center></h2>
This is a nice little clock class that was contributed to by several
members of the wxPython-users group.
<p>
Check the options available by right-clicking the clock.
</body></html>
"""
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])

View File

@@ -2,6 +2,9 @@
import wx
import images
#import wx.lib.buttons
#wx.BitmapButton = wx.lib.buttons.GenBitmapButton
#----------------------------------------------------------------------
class TestPanel(wx.Panel):
@@ -29,11 +32,20 @@ class TestPanel(wx.Panel):
mask = wx.Mask(bmp, wx.BLUE)
bmp.SetMask(mask)
b = wx.BitmapButton(self, 30, bmp, (20, 20),
b = wx.BitmapButton(self, -1, bmp, (20, 20),
(bmp.GetWidth()+10, bmp.GetHeight()+10))
b.SetToolTipString("This is a bitmap button.")
self.Bind(wx.EVT_BUTTON, self.OnClick, b)
b = wx.BitmapButton(self, 30, bmp, (20, 120),
style = wx.NO_BORDER)
# hide a little surprise in the button...
b.SetBitmapSelected(images.getRobinBitmap())
b.SetToolTipString("This is a bitmap button with \nwx.NO_BORDER style.")
self.Bind(wx.EVT_BUTTON, self.OnClick, b)
def OnClick(self, event):
self.log.write("Click! (%d)\n" % event.GetId())

View File

@@ -0,0 +1,96 @@
import sys
import wx
from wx.lib.mixins.listctrl import CheckListCtrlMixin
from ListCtrl import musicdata
#----------------------------------------------------------------------
class CheckListCtrl(wx.ListCtrl, CheckListCtrlMixin):
def __init__(self, parent, log):
wx.ListCtrl.__init__(self, parent, -1, style=wx.LC_REPORT)
CheckListCtrlMixin.__init__(self)
self.log = log
self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.OnItemActivated)
def OnItemActivated(self, evt):
self.ToggleItem(evt.m_itemIndex)
# this is called by the base class when an item is checked/unchecked
def OnCheckItem(self, index, flag):
data = self.GetItemData(index)
title = musicdata[data][1]
if flag:
what = "checked"
else:
what = "unchecked"
self.log.write('item "%s", at index %d was %s\n' % (title, index, what))
class TestPanel(wx.Panel):
def __init__(self, parent, log):
self.log = log
wx.Panel.__init__(self, parent, -1)
self.list = CheckListCtrl(self, log)
sizer = wx.BoxSizer()
sizer.Add(self.list, 1, wx.EXPAND)
self.SetSizer(sizer)
self.list.InsertColumn(0, "Artist")
self.list.InsertColumn(1, "Title", wx.LIST_FORMAT_RIGHT)
self.list.InsertColumn(2, "Genre")
for key, data in musicdata.iteritems():
index = self.list.InsertStringItem(sys.maxint, data[0])
self.list.SetStringItem(index, 1, data[1])
self.list.SetStringItem(index, 2, data[2])
self.list.SetItemData(index, key)
self.list.SetColumnWidth(0, wx.LIST_AUTOSIZE)
self.list.SetColumnWidth(1, wx.LIST_AUTOSIZE)
self.list.SetColumnWidth(2, 100)
self.list.CheckItem(4)
self.list.CheckItem(7)
self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnItemSelected, self.list)
self.Bind(wx.EVT_LIST_ITEM_DESELECTED, self.OnItemDeselected, self.list)
def OnItemSelected(self, evt):
self.log.write('item selected: %s\n' % evt.m_itemIndex)
def OnItemDeselected(self, evt):
self.log.write('item deselected: %s\n' % evt.m_itemIndex)
#----------------------------------------------------------------------
def runTest(frame, nb, log):
win = TestPanel(nb, log)
return win
#----------------------------------------------------------------------
overview = """<html><body>
<h2><centerCheckListCtrlMixin></center></h2>
CheckListCtrlMixin is a simple mixin class that can add a checkbox to
the first column of a wx.ListCtrl.
</body></html>
"""
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])

View File

@@ -53,6 +53,7 @@ class TestWindow(wx.ScrolledWindow):
# Event handlers - moved here so events won't fire before init is
# finished.
self.SetBackgroundStyle(wx.BG_STYLE_CUSTOM)
self.Bind(wx.EVT_PAINT, self.OnPaint)
self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground)

View File

@@ -47,12 +47,11 @@ class TestComboBox(wx.Panel):
cb.Append(item, item.upper())
self.Bind(wx.EVT_COMBOBOX, self.EvtComboBox, cb)
self.Bind(wx.EVT_COMBOBOX, self.EvtText, cb)
# When the user selects something, we go here.
def EvtComboBox(self, evt):
cb = evt.GetEventObject()
data = cb.GetClientData(cb.GetSelection())
data = cb.GetClientData(evt.GetSelection())
self.log.WriteText('EvtComboBox: %s\nClientData: %s\n' % (evt.GetString(), data))
if evt.GetString() == 'one':
@@ -61,11 +60,13 @@ class TestComboBox(wx.Panel):
# Capture events every time a user hits a key in the text entry field.
def EvtText(self, evt):
self.log.WriteText('EvtText: %s\n' % evt.GetString())
evt.Skip()
# Capture events when the user types something into the control then
# hits ENTER.
def EvtTextEnter(self, evt):
self.log.WriteText('EvtTextEnter: %s' % evt.GetString())
evt.Skip()
#---------------------------------------------------------------------------

View File

@@ -0,0 +1,69 @@
import wx
from wx.lib.combotreebox import ComboTreeBox
#---------------------------------------------------------------------------
class TestComboTreeBox(wx.Panel):
def __init__(self, parent, log):
super(TestComboTreeBox, self).__init__(parent)
self.log = log
panelSizer = wx.FlexGridSizer(2, 2)
panelSizer.AddGrowableCol(1)
for style, labelText in [(0, 'Default style:'),
(wx.CB_READONLY, 'Read-only style:')]:
label = wx.StaticText(self, label=labelText)
panelSizer.Add(label, flag=wx.ALL|wx.ALIGN_CENTER_VERTICAL,
border=5)
comboBox = self._createComboTreeBox(style)
panelSizer.Add(comboBox, flag=wx.EXPAND|wx.ALL, border=5)
self.SetSizerAndFit(panelSizer)
def _createComboTreeBox(self, style):
comboBox = ComboTreeBox(self, style=style)
self._bindEventHandlers(comboBox)
for i in range(5):
child = comboBox.Append('Item %d'%i)
for j in range(5):
grandChild = comboBox.Append('Item %d.%d'%(i,j), child)
for k in range(5):
comboBox.Append('Item %d.%d.%d'%(i,j, k), grandChild)
return comboBox
def _bindEventHandlers(self, comboBox):
for eventType, handler in [(wx.EVT_COMBOBOX, self.OnItemSelected),
(wx.EVT_TEXT, self.OnItemEntered)]:
comboBox.Bind(eventType, handler)
def OnItemSelected(self, event):
self.log.WriteText('You selected: %s\n'%event.GetString())
event.Skip()
def OnItemEntered(self, event):
self.log.WriteText('You entered: %s\n'%event.GetString())
event.Skip()
#---------------------------------------------------------------------------
def runTest(frame, nb, log):
win = TestComboTreeBox(nb, log)
return win
#---------------------------------------------------------------------------
overview = wx.lib.combotreebox.__doc__
#---------------------------------------------------------------------------
if __name__ == '__main__':
import sys, os
import run
run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])

View File

@@ -14,11 +14,11 @@ class DoodlePad(wx.Window):
self.x = self.y = 0
self.SetMode("Draw")
wx.EVT_LEFT_DOWN(self, self.OnLeftDown)
wx.EVT_LEFT_UP(self, self.OnLeftUp)
wx.EVT_RIGHT_UP(self, self.OnRightUp)
wx.EVT_MOTION(self, self.OnMotion)
wx.EVT_PAINT(self, self.OnPaint)
self.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown)
self.Bind(wx.EVT_LEFT_UP, self.OnLeftUp)
self.Bind(wx.EVT_RIGHT_UP, self.OnRightUp)
self.Bind(wx.EVT_MOTION, self.OnMotion)
self.Bind(wx.EVT_PAINT, self.OnPaint)
def SetMode(self, mode):
@@ -182,7 +182,7 @@ class DoodleViewer(wx.Window):
self.x = self.y = 0
dt = DoodleDropTarget(self, log)
self.SetDropTarget(dt)
wx.EVT_PAINT(self, self.OnPaint)
self.Bind(wx.EVT_PAINT, self.OnPaint)
def SetLines(self, lines):
@@ -256,8 +256,8 @@ class CustomDnDPanel(wx.Panel):
self.SetSizer(sizer)
# Events
wx.EVT_RADIOBUTTON(self, rb1.GetId(), self.OnRadioButton)
wx.EVT_RADIOBUTTON(self, rb2.GetId(), self.OnRadioButton)
self.Bind(wx.EVT_RADIOBUTTON, self.OnRadioButton, rb1)
self.Bind(wx.EVT_RADIOBUTTON, self.OnRadioButton, rb2)
def OnRadioButton(self, evt):
@@ -314,11 +314,11 @@ if __name__ == '__main__':
def MakeFrame(self, event=None):
frame = wx.Frame(None, -1, "Custom Drag and Drop", size=(550,400))
menu = wx.Menu()
menu.Append(6543, "Window")
item = menu.Append(-1, "Window")
mb = wx.MenuBar()
mb.Append(menu, "New")
frame.SetMenuBar(mb)
wx.EVT_MENU(frame, 6543, self.MakeFrame)
frame.Bind(wx.EVT_MENU, self.MakeFrame, item)
panel = TestPanel(frame, DummyLog())
frame.Show(True)
self.SetTopWindow(frame)

View File

@@ -47,6 +47,7 @@ class DragCanvas(wx.ScrolledWindow):
self.SetCursor(wx.StockCursor(wx.CURSOR_ARROW))
self.bg_bmp = images.getBackgroundBitmap()
self.SetBackgroundStyle(wx.BG_STYLE_CUSTOM)
# Make a shape from an image and mask. This one will demo
# dragging outside the window

View File

@@ -0,0 +1,57 @@
import wx
import wx.lib.dragscroller
#-------------------------------------------------------------------------------
def runTest(frame, nb, log):
win = DragScrollerExample(nb, -1)
return win
class DragScrollerExample(wx.ScrolledWindow):
def __init__(self, parent, id=-1):
wx.ScrolledWindow.__init__(self, parent, id)
self.Bind(wx.EVT_PAINT, self.OnPaint)
self.Bind(wx.EVT_RIGHT_DOWN, self.OnRightDown)
self.Bind(wx.EVT_RIGHT_UP, self.OnRightUp)
self.SetScrollbars(1, 1, 2000, 2000, 0, 0)
self.scroller = wx.lib.dragscroller.DragScroller(self)
def OnPaint(self, event):
dc = wx.PaintDC(self)
self.DoPrepareDC(dc)
pen = wx.Pen(wx.BLACK, 5)
dc.SetPen(pen)
for y in range(10):
for x in range(10):
dc.DrawCircle(x*400+20, y*400+20, 200)
dc.DrawText('Right click and drag in the direction you want to scroll.',
20, 20)
dc.DrawText('The distance from the start of the drag determines the speed.',
20, 50)
def OnRightDown(self, event):
self.scroller.Start(event.GetPosition())
def OnRightUp(self, event):
self.scroller.Stop()
#-------------------------------------------------------------------------------
overview = """<html><body>
<h2>DragScroller</h2>
<p>
A helper class that adds scrolling to a wx.ScrolledWindow in the direction
of the drag.
</body></html>
"""
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])])

View File

@@ -72,7 +72,7 @@ class TestPanel(wx.Panel):
sizer.Add(message0, 0, wx.ALIGN_CENTER | wx.ALL, 6)
sizer.Add(title2, 0, wx.ALIGN_CENTER | wx.LEFT | wx.TOP | wx.RIGHT, 16)
sizer.Add(message1, 0, wx.ALIGN_CENTER | wx.ALL, 6)
sizer.Add(buttonPanel, 0, wx.EXPAND | wx.LEFT | wx.BOTTOM | wx.RIGHT, 16)
sizer.Add(buttonPanel, 0, wx.EXPAND | wx.ALL, 16)
sizer.Add(title3, 0, wx.ALIGN_CENTER | wx.LEFT | wx.RIGHT, 16)
sizer.Add(message2, 0, wx.ALIGN_CENTER | wx.ALL, 6)
sizer.Add(targetPanel, 2, wx.EXPAND | wx.LEFT | wx.BOTTOM | wx.RIGHT, 16)
@@ -144,6 +144,7 @@ class InnerTile(wx.Window):
"""
def __init__(self, parent, log, factor, thingToWatch=None, bgColor=None):
wx.Window.__init__(self, parent, -1)
self.SetMinSize((20,20))
self.log=log
if bgColor:
self.SetBackgroundColour(bgColor)

View File

@@ -27,7 +27,8 @@ class TestPanel(wx.Panel):
self, -1, size=(450, -1), changeCallback = self.dbbCallback
)
self.fbbh.SetHistory(['You', 'can', 'put', 'some', 'filenames', 'here'])
self.fbbh.callCallback = False
self.fbbh.SetHistory(['You', 'can', 'put', 'some', 'filenames', 'here'], 4)
sizer = wx.BoxSizer(wx.VERTICAL)
sizer.Add(self.fbb, 0, wx.ALL, 5)
@@ -45,6 +46,8 @@ class TestPanel(wx.Panel):
def fbbhCallback(self, evt):
if hasattr(self, 'fbbh'):
value = evt.GetString()
if not value:
return
self.log.write('FileBrowseButtonWithHistory: %s\n' % value)
history = self.fbbh.GetHistory()
if value not in history:

View File

@@ -79,7 +79,7 @@ class TestPanel(wx.Panel):
def OnRightClick(self, evt):
self.PopupMenu(self.menu, evt.GetPosition())
self.PopupMenu(self.menu)
def OnFileOpenDialog(self, evt):

View File

@@ -2,7 +2,7 @@
# Please note that wx.lib.floatbar is not formally supported as
# part of wxPython. If it works, fine. If not, unfortunate.
# GTK users can use the wx.TB_DOCKABLE flag with a regular
# wx.ToolBar, but everyone else has to take thier chances.
# wx.ToolBar, but everyone else has to take their chances.
#
import wx

File diff suppressed because it is too large Load Diff

View File

@@ -171,7 +171,7 @@ class Extended(wx.Frame):
"Please report any bug/requests or improvements\n" + \
"To me at the following adresses:\n\n" + \
"andrea.gavana@agip.it\n" + "andrea_gavana@tin.it\n\n" + \
"Based On Julian Smart C++ demo implementation.\n\n" + \
"Based On Jorgen Bodde C++ demo implementation.\n\n" + \
"Welcome To wxPython " + wx.VERSION_STRING + "!!"
dlg = wx.MessageDialog(self, msg, "FoldPanelBar Extended Demo",
@@ -344,6 +344,10 @@ class Extended(wx.Frame):
# or normal
if event.IsChecked():
self.GetMenuBar().Check(self._singlestyle, False)
self.GetMenuBar().Check(self._exclusivestyle, False)
self._flags = self._flags & ~fpb.FPB_SINGLE_FOLD
self._flags = self._flags & ~fpb.FPB_EXCLUSIVE_FOLD
self._flags = self._flags | fpb.FPB_COLLAPSE_TO_BOTTOM
else:
self._flags = self._flags & ~fpb.FPB_COLLAPSE_TO_BOTTOM
@@ -352,13 +356,15 @@ class Extended(wx.Frame):
def OnCreateNormalStyle(self, event):
# recreate with style where only one panel at the time is
# allowed to be opened
# TODO: Not yet implemented even in the C++ class!!!!
if event.IsChecked():
self.GetMenuBar().Check(self._bottomstyle, False)
self.GetMenuBar().Check(self._exclusivestyle, False)
self._flags = self._flags & ~fpb.FPB_EXCLUSIVE_FOLD
self._flags = self._flags & ~fpb.FPB_COLLAPSE_TO_BOTTOM
self._flags = self._flags | fpb.FPB_SINGLE_FOLD
else:
self._flags = self._flags & ~fpb.FPB_SINGLE_FOLD
@@ -366,6 +372,23 @@ class Extended(wx.Frame):
self.ReCreateFoldPanel(self._flags)
def OnCreateExclusiveStyle(self, event):
# recreate with style where only one panel at the time is
# allowed to be opened and the others are collapsed to bottom
if event.IsChecked():
self.GetMenuBar().Check(self._singlestyle, False)
self.GetMenuBar().Check(self._bottomstyle, False)
self._flags = self._flags & ~fpb.FPB_SINGLE_FOLD
self._flags = self._flags & ~fpb.FPB_COLLAPSE_TO_BOTTOM
self._flags = self._flags | fpb.FPB_EXCLUSIVE_FOLD
else:
self._flags = self._flags & ~fpb.FPB_EXCLUSIVE_FOLD
self.ReCreateFoldPanel(self._flags)
def OnCollapseMe(self, event):
for i in range(0, self._pnl.GetCount()):
@@ -487,8 +510,9 @@ class Extended(wx.Frame):
FPBTEST_QUIT = wx.NewId()
FPBTEST_REFRESH = wx.NewId()
FPB_BOTTOM_STICK = wx.NewId()
FPB_BOTTOM_FOLD = wx.NewId()
FPB_SINGLE_FOLD = wx.NewId()
FPB_EXCLUSIVE_FOLD = wx.NewId()
FPBTEST_TOGGLE_WINDOW = wx.NewId()
FPBTEST_ABOUT = wx.NewId()
@@ -504,10 +528,13 @@ class Extended(wx.Frame):
# make fold panel menu
fpb_menu = wx.Menu()
fpb_menu.AppendCheckItem(FPB_BOTTOM_STICK, "Create with &fpb.FPB_COLLAPSE_TO_BOTTOM")
fpb_menu.AppendCheckItem(FPB_BOTTOM_FOLD, "Create with &fpb.FPB_COLLAPSE_TO_BOTTOM")
# Not Yet Implemented In The C++ class!!!
# fpb_menu.AppendCheckItem(FPB_SINGLE_FOLD, _T("Create with &FPB_SINGLE_FOLD"))
# Now Implemented!
fpb_menu.AppendCheckItem(FPB_SINGLE_FOLD, "Create with &fpb.FPB_SINGLE_FOLD")
# Now Implemented!
fpb_menu.AppendCheckItem(FPB_EXCLUSIVE_FOLD, "Create with &fpb.FPB_EXCLUSIVE_FOLD")
fpb_menu.AppendSeparator()
fpb_menu.Append(FPBTEST_TOGGLE_WINDOW, "&Toggle FoldPanelBar")
@@ -528,8 +555,13 @@ class Extended(wx.Frame):
self.Bind(wx.EVT_MENU, self.OnAbout, id=FPBTEST_ABOUT)
self.Bind(wx.EVT_MENU, self.OnQuit, id=FPBTEST_QUIT)
self.Bind(wx.EVT_MENU, self.OnToggleWindow, id=FPBTEST_TOGGLE_WINDOW)
self.Bind(wx.EVT_MENU, self.OnCreateBottomStyle, id=FPB_BOTTOM_STICK)
self.Bind(wx.EVT_MENU, self.OnCreateBottomStyle, id=FPB_BOTTOM_FOLD)
self.Bind(wx.EVT_MENU, self.OnCreateNormalStyle, id=FPB_SINGLE_FOLD)
self.Bind(wx.EVT_MENU, self.OnCreateExclusiveStyle, id=FPB_EXCLUSIVE_FOLD)
self._bottomstyle = FPB_BOTTOM_FOLD
self._singlestyle = FPB_SINGLE_FOLD
self._exclusivestyle = FPB_EXCLUSIVE_FOLD
return menu_bar

View File

@@ -1,5 +1,6 @@
import wx
from wx.lib import stattext
#---------------------------------------------------------------------------
@@ -11,7 +12,8 @@ class TestPanel(wx.Panel):
btn = wx.Button(self, -1, "Select Font")
self.Bind(wx.EVT_BUTTON, self.OnSelectFont, btn)
self.sampleText = wx.TextCtrl(self, -1, "Sample Text")
self.sampleText = stattext.GenStaticText(self, -1, "Sample Text")
self.sampleText.SetBackgroundColour(wx.WHITE)
self.curFont = self.sampleText.GetFont()
self.curClr = wx.BLACK
@@ -69,6 +71,7 @@ class TestPanel(wx.Panel):
def UpdateUI(self):
self.sampleText.SetFont(self.curFont)
self.sampleText.SetForegroundColour(self.curClr)
self.ps.SetLabel(str(self.curFont.GetPointSize()))
self.family.SetLabel(self.curFont.GetFamilyString())
self.style.SetLabel(self.curFont.GetStyleString())

View File

@@ -80,6 +80,7 @@ class MyCanvasBase(glcanvas.GLCanvas):
# initial mouse position
self.lastx = self.x = 30
self.lasty = self.y = 30
self.size = None
self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground)
self.Bind(wx.EVT_SIZE, self.OnSize)
self.Bind(wx.EVT_PAINT, self.OnPaint)
@@ -93,7 +94,7 @@ class MyCanvasBase(glcanvas.GLCanvas):
def OnSize(self, event):
size = self.GetClientSize()
size = self.size = self.GetClientSize()
if self.GetContext():
self.SetCurrent()
glViewport(0, 0, size.width, size.height)
@@ -111,6 +112,7 @@ class MyCanvasBase(glcanvas.GLCanvas):
def OnMouseDown(self, evt):
self.CaptureMouse()
self.x, self.y = self.lastx, self.lasty = evt.GetPosition()
def OnMouseUp(self, evt):
@@ -119,7 +121,7 @@ class MyCanvasBase(glcanvas.GLCanvas):
def OnMouseMotion(self, evt):
if evt.Dragging() and evt.LeftIsDown():
self.x, self.y = self.lastx, self.lasty
self.lastx, self.lasty = self.x, self.y
self.x, self.y = evt.GetPosition()
self.Refresh(False)
@@ -129,25 +131,25 @@ class MyCanvasBase(glcanvas.GLCanvas):
class CubeCanvas(MyCanvasBase):
def InitGL(self):
# set viewing projection
glMatrixMode(GL_PROJECTION);
glFrustum(-0.5, 0.5, -0.5, 0.5, 1.0, 3.0);
glMatrixMode(GL_PROJECTION)
glFrustum(-0.5, 0.5, -0.5, 0.5, 1.0, 3.0)
# position viewer
glMatrixMode(GL_MODELVIEW);
glTranslatef(0.0, 0.0, -2.0);
glMatrixMode(GL_MODELVIEW)
glTranslatef(0.0, 0.0, -2.0)
# position object
glRotatef(self.y, 1.0, 0.0, 0.0);
glRotatef(self.x, 0.0, 1.0, 0.0);
glRotatef(self.y, 1.0, 0.0, 0.0)
glRotatef(self.x, 0.0, 1.0, 0.0)
glEnable(GL_DEPTH_TEST);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glEnable(GL_DEPTH_TEST)
glEnable(GL_LIGHTING)
glEnable(GL_LIGHT0)
def OnDraw(self):
# clear color and depth buffers
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
# draw six faces of a cube
glBegin(GL_QUADS)
@@ -188,8 +190,15 @@ class CubeCanvas(MyCanvasBase):
glVertex3f(-0.5, 0.5,-0.5)
glEnd()
glRotatef((self.lasty - self.y)/100., 1.0, 0.0, 0.0);
glRotatef((self.lastx - self.x)/100., 0.0, 1.0, 0.0);
if self.size is None:
self.size = self.GetClientSize()
w, h = self.size
w = max(w, 1.0)
h = max(h, 1.0)
xScale = 180.0 / w
yScale = 180.0 / h
glRotatef((self.y - self.lasty) * yScale, 1.0, 0.0, 0.0);
glRotatef((self.x - self.lastx) * xScale, 0.0, 1.0, 0.0);
self.SwapBuffers()
@@ -199,9 +208,9 @@ class CubeCanvas(MyCanvasBase):
class ConeCanvas(MyCanvasBase):
def InitGL( self ):
glMatrixMode(GL_PROJECTION);
glMatrixMode(GL_PROJECTION)
# camera frustrum setup
glFrustum(-0.5, 0.5, -0.5, 0.5, 1.0, 3.0);
glFrustum(-0.5, 0.5, -0.5, 0.5, 1.0, 3.0)
glMaterial(GL_FRONT, GL_AMBIENT, [0.2, 0.2, 0.2, 1.0])
glMaterial(GL_FRONT, GL_DIFFUSE, [0.8, 0.8, 0.8, 1.0])
glMaterial(GL_FRONT, GL_SPECULAR, [1.0, 0.0, 1.0, 1.0])
@@ -209,7 +218,7 @@ class ConeCanvas(MyCanvasBase):
glLight(GL_LIGHT0, GL_AMBIENT, [0.0, 1.0, 0.0, 1.0])
glLight(GL_LIGHT0, GL_DIFFUSE, [1.0, 1.0, 1.0, 1.0])
glLight(GL_LIGHT0, GL_SPECULAR, [1.0, 1.0, 1.0, 1.0])
glLight(GL_LIGHT0, GL_POSITION, [1.0, 1.0, 1.0, 0.0]);
glLight(GL_LIGHT0, GL_POSITION, [1.0, 1.0, 1.0, 0.0])
glLightModel(GL_LIGHT_MODEL_AMBIENT, [0.2, 0.2, 0.2, 1.0])
glEnable(GL_LIGHTING)
glEnable(GL_LIGHT0)
@@ -217,25 +226,28 @@ class ConeCanvas(MyCanvasBase):
glEnable(GL_DEPTH_TEST)
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
# position viewer
glMatrixMode(GL_MODELVIEW);
glMatrixMode(GL_MODELVIEW)
# position viewer
glTranslatef(0.0, 0.0, -2.0);
def OnDraw(self):
# clear color and depth buffers
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
# use a fresh transformation matrix
glPushMatrix()
# position object
glTranslate(0.0, 0.0, -2.0);
glRotate(30.0, 1.0, 0.0, 0.0);
glRotate(30.0, 0.0, 1.0, 0.0);
#glTranslate(0.0, 0.0, -2.0)
glRotate(30.0, 1.0, 0.0, 0.0)
glRotate(30.0, 0.0, 1.0, 0.0)
glTranslate(0, -1, 0)
glRotate(250, 1, 0, 0)
glutSolidCone(0.5, 1, 30, 5)
glPopMatrix()
glRotatef((self.lasty - self.y)/100., 0.0, 0.0, 1.0);
glRotatef(0.0, (self.lastx - self.x)/100., 1.0, 0.0);
glRotatef((self.y - self.lasty), 0.0, 0.0, 1.0);
glRotatef((self.x - self.lastx), 1.0, 0.0, 0.0);
# push into visible buffer
self.SwapBuffers()

View File

@@ -0,0 +1,142 @@
import wx
#----------------------------------------------------------------------
class StaticText(wx.StaticText):
"""
A StaticText that only updates the label if it has changed, to
help reduce potential flicker since these controls would be
updated very frequently otherwise.
"""
def SetLabel(self, label):
if label <> self.GetLabel():
wx.StaticText.SetLabel(self, label)
#----------------------------------------------------------------------
class TestPanel(wx.Panel):
def __init__(self, parent, log):
self.log = log
wx.Panel.__init__(self, parent, -1)
sizer = wx.BoxSizer(wx.VERTICAL)
self.SetSizer(sizer)
sizer.Add((25,25))
sizer.Add(wx.StaticText(
self, -1,
"Mouse and modifier state can be polled with wx.GetMouseState"),
0, wx.CENTER|wx.ALL, 10)
sizer.Add(wx.StaticLine(self), 0, wx.EXPAND|wx.TOP, 10)
row = wx.BoxSizer(wx.HORIZONTAL)
sizer.Add(row, 0, wx.CENTER)
fgs = wx.FlexGridSizer(cols=2, hgap=5, vgap=10)
row.Add(fgs, 0, wx.ALL, 30)
lbl = StaticText(self, -1, "X pos:")
self.x = StaticText(self, -1, "00000")
fgs.Add(lbl)
fgs.Add(self.x)
lbl = StaticText(self, -1, "Y pos:")
self.y = StaticText(self, -1, "00000")
fgs.Add(lbl)
fgs.Add(self.y)
lbl = StaticText(self, -1, "Left down:")
self.lft = StaticText(self, -1, "False")
fgs.Add(lbl)
fgs.Add(self.lft)
lbl = StaticText(self, -1, "Middle Down:")
self.mid = StaticText(self, -1, "False")
fgs.Add(lbl)
fgs.Add(self.mid)
lbl = StaticText(self, -1, "Right down:")
self.rgt = StaticText(self, -1, "False")
fgs.Add(lbl)
fgs.Add(self.rgt)
fgs = wx.FlexGridSizer(cols=2, hgap=5, vgap=10)
row.Add(fgs, 0, wx.ALL, 30)
lbl = StaticText(self, -1, "Control down:")
self.ctrl = StaticText(self, -1, "False")
fgs.Add(lbl)
fgs.Add(self.ctrl)
lbl = StaticText(self, -1, "Shift down:")
self.shft = StaticText(self, -1, "False")
fgs.Add(lbl)
fgs.Add(self.shft)
lbl = StaticText(self, -1, "Alt down:")
self.alt = StaticText(self, -1, "False")
fgs.Add(lbl)
fgs.Add(self.alt)
lbl = StaticText(self, -1, "Meta down:")
self.meta = StaticText(self, -1, "False")
fgs.Add(lbl)
fgs.Add(self.meta)
lbl = StaticText(self, -1, "Cmd down:")
self.cmd = StaticText(self, -1, "False")
fgs.Add(lbl)
fgs.Add(self.cmd)
self.timer = wx.Timer(self)
self.Bind(wx.EVT_TIMER, self.OnTimer, self.timer)
self.timer.Start(100)
def OnTimer(self, evt):
ms = wx.GetMouseState()
self.x.SetLabel( str(ms.x) )
self.y.SetLabel( str(ms.y) )
self.lft.SetLabel( str(ms.leftDown) )
self.mid.SetLabel( str(ms.middleDown) )
self.rgt.SetLabel( str(ms.rightDown) )
self.ctrl.SetLabel( str(ms.controlDown) )
self.shft.SetLabel( str(ms.shiftDown) )
self.alt.SetLabel( str(ms.altDown) )
self.meta.SetLabel( str(ms.metaDown) )
self.cmd.SetLabel( str(ms.cmdDown) )
#----------------------------------------------------------------------
def runTest(frame, nb, log):
win = TestPanel(nb, log)
return win
#----------------------------------------------------------------------
overview = """<html><body>
<h2><center>wx.GetMouseState</center></h2>
The mouse and modifier state can be polled with the wx.GetMouseState
function. It returns an instance of a wx.MouseState object that
contains the current position of the mouse pointer in screen
coordinates, as well as boolean values indicating the up/down status
of the mouse buttons and the modifier keys.
</body></html>
"""
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])

View File

@@ -150,8 +150,6 @@ class MyCellEditor(gridlib.PyGridCellEditor):
elif key < 256 and key >= 0 and chr(key) in string.printable:
ch = chr(key)
if not evt.ShiftDown():
ch = ch.lower()
if ch is not None:
# For this example, replace the text. Normally we would append it.

View File

@@ -354,7 +354,7 @@ class MegaGrid(Grid.Grid):
self.Bind(wx.EVT_MENU, append, id=appendID)
self.Bind(wx.EVT_MENU, delete, id=deleteID)
self.PopupMenu(menu, (x, yo))
self.PopupMenu(menu)
menu.Destroy()
return
@@ -388,7 +388,7 @@ class MegaGrid(Grid.Grid):
if len(cols) == 1:
self.Bind(wx.EVT_MENU, sort, id=sortID)
self.PopupMenu(menu, (xo, 0))
self.PopupMenu(menu)
menu.Destroy()
return

View File

@@ -16,15 +16,9 @@ class MyHtmlWindow(html.HtmlWindow):
def __init__(self, parent, id, log):
html.HtmlWindow.__init__(self, parent, id, style=wx.NO_FULL_REPAINT_ON_RESIZE)
self.log = log
self.Bind(wx.EVT_SCROLLWIN, self.OnScroll )
if "gtk2" in wx.PlatformInfo:
self.SetStandardFonts()
def OnScroll( self, event ):
#print 'event.GetOrientation()',event.GetOrientation()
#print 'event.GetPosition()',event.GetPosition()
event.Skip()
def OnLinkClicked(self, linkinfo):
self.log.WriteText('OnLinkClicked: %s\n' % linkinfo.GetHref())
@@ -42,6 +36,9 @@ class MyHtmlWindow(html.HtmlWindow):
def OnCellClicked(self, cell, x, y, evt):
self.log.WriteText('OnCellClicked: %s, (%d %d)\n' % (cell, x, y))
if isinstance(cell, html.HtmlWordCell):
sel = html.HtmlSelection()
self.log.WriteText(' %s\n' % cell.ConvertToText(sel))
self.base_OnCellClicked(cell, x, y, evt)

View File

@@ -89,13 +89,13 @@ class TestPanel(wx.Panel):
def OnRightLink(self, event):
pos = event.GetPosition()
pos = self._hyper3.GetPosition() + event.GetPosition()
menuPopUp = wx.Menu("Having a nice day?")
ID_MENU_YES = wx.NewId()
ID_MENU_NO = wx.NewId()
menuPopUp.Append(ID_MENU_YES, "Yes, absolutely!")
menuPopUp.Append(ID_MENU_NO, "I've had better")
self.PopupMenu(menuPopUp, self._hyper3.GetPosition())
self.PopupMenu(menuPopUp)
menuPopUp.Destroy()

View File

@@ -231,6 +231,8 @@ class KeyLog(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin):
if keycode <= 127:
keycode = evt.GetKeyCode()
keyname = "\"" + unichr(evt.GetUnicodeKey()) + "\""
if keycode < 27:
keyname = "Ctrl-%s" % chr(ord('A') + keycode-1)
elif keycode < 256:
if keycode == 0:

View File

@@ -56,7 +56,7 @@ class TestLayoutConstraints(wx.Panel):
lc.centreY.SameAs (self.panelA, wx.CentreY)
lc.height.AsIs ()
lc.width.PercentOf (self.panelA, wx.Width, 50)
b.SetConstraints(lc);
b.SetConstraints(lc)
b = wx.Button(self.panelB, 100, ' Panel B ')
lc = wx.LayoutConstraints()
@@ -64,7 +64,7 @@ class TestLayoutConstraints(wx.Panel):
lc.right.SameAs (self.panelB, wx.Right, 4)
lc.height.AsIs ()
lc.width.AsIs ()
b.SetConstraints(lc);
b.SetConstraints(lc)
self.panelD = wx.Window(self.panelC, -1, style=wx.SIMPLE_BORDER)
self.panelD.SetBackgroundColour(wx.GREEN)
@@ -78,14 +78,14 @@ class TestLayoutConstraints(wx.Panel):
lc.left.RightOf (self.panelD)
lc.height.AsIs ()
lc.width.AsIs ()
b.SetConstraints(lc);
b.SetConstraints(lc)
lc = wx.LayoutConstraints()
lc.bottom.PercentOf (self.panelC, wx.Height, 50)
lc.right.PercentOf (self.panelC, wx.Width, 50)
lc.height.SameAs (b, wx.Height)
lc.width.SameAs (b, wx.Width)
self.panelD.SetConstraints(lc);
self.panelD.SetConstraints(lc)
def OnButton(self, event):

View File

@@ -75,8 +75,8 @@ class TestListBox(wx.Panel):
'twelve', 'thirteen', 'fourteen']
wx.StaticText(self, -1, "This example uses the wx.ListBox control.", (45, 10))
wx.StaticText(self, -1, "Select one:", (15, 50), (65, 18))
self.lb1 = wx.ListBox(self, 60, (80, 50), (90, 120), sampleList, wx.LB_SINGLE)
wx.StaticText(self, -1, "Select one:", (15, 50))
self.lb1 = wx.ListBox(self, 60, (100, 50), (90, 120), sampleList, wx.LB_SINGLE)
self.Bind(wx.EVT_LISTBOX, self.EvtListBox, self.lb1)
self.Bind(wx.EVT_LISTBOX_DCLICK, self.EvtListBoxDClick, self.lb1)
self.lb1.Bind(wx.EVT_RIGHT_UP, self.EvtRightButton)
@@ -85,8 +85,8 @@ class TestListBox(wx.Panel):
self.lb1.SetClientData(2, "This one has data");
wx.StaticText(self, -1, "Select many:", (200, 50), (65, 18))
self.lb2 = wx.ListBox(self, 70, (300, 50), (90, 120), sampleList, wx.LB_EXTENDED)
wx.StaticText(self, -1, "Select many:", (220, 50))
self.lb2 = wx.ListBox(self, 70, (320, 50), (90, 120), sampleList, wx.LB_EXTENDED)
self.Bind(wx.EVT_LISTBOX, self.EvtMultiListBox, self.lb2)
self.lb2.Bind(wx.EVT_RIGHT_UP, self.EvtRightButton)
self.lb2.SetSelection(0)
@@ -96,13 +96,16 @@ class TestListBox(wx.Panel):
'test abcd' ]
sampleList.sort()
wx.StaticText(self, -1, "Find Prefix:", (15, 250))
fp = FindPrefixListBox(self, -1, (80, 250), (90, 120), sampleList, wx.LB_SINGLE)
fp = FindPrefixListBox(self, -1, (100, 250), (90, 120), sampleList, wx.LB_SINGLE)
fp.SetSelection(0)
def EvtListBox(self, event):
self.log.WriteText('EvtListBox: %s, %s, %s\n' %
(event.GetString(), event.IsSelection(), event.GetSelection()))
self.log.WriteText('EvtListBox: %s, %s, %s, %s\n' %
(event.GetString(),
event.IsSelection(),
event.GetSelection(),
event.GetClientData()))
lb = event.GetEventObject()
data = lb.GetClientData(lb.GetSelection())

View File

@@ -200,10 +200,10 @@ class TestListCtrlPanel(wx.Panel, listmix.ColumnSorterMixin):
def OnRightDown(self, event):
self.x = event.GetX()
self.y = event.GetY()
self.log.WriteText("x, y = %s\n" % str((self.x, self.y)))
item, flags = self.list.HitTest((self.x, self.y))
x = event.GetX()
y = event.GetY()
self.log.WriteText("x, y = %s\n" % str((x, y)))
item, flags = self.list.HitTest((x, y))
if flags & wx.LIST_HITTEST_ONITEM:
self.list.Select(item)
@@ -313,7 +313,7 @@ class TestListCtrlPanel(wx.Panel, listmix.ColumnSorterMixin):
# Popup the menu. If an item is selected then its handler
# will be called before PopupMenu returns.
self.PopupMenu(menu, (self.x, self.y))
self.PopupMenu(menu)
menu.Destroy()

View File

@@ -1,8 +1,7 @@
import wx
import MDIDemo
import MDISashDemo
import os
import sys
#----------------------------------------------------------------------
@@ -25,16 +24,33 @@ class TestPanel(wx.Panel):
self.SetSizer(box)
# These are spawned as new processes because on Mac there can be
# some problems related to having regular frames and MDI frames in
# the same app.
def ShowMDIDemo(self, evt):
frame = MDIDemo.MyParentFrame()
frame.Show()
exe, spawn = self.GetPyExecutable()
spawn(os.P_NOWAIT, exe, exe, "MDIDemo.py")
def ShowMDISashDemo(self, evt):
frame = MDISashDemo.MyParentFrame()
frame.Show()
exe, spawn = self.GetPyExecutable()
spawn(os.P_NOWAIT, exe, exe, "MDISashDemo.py")
# TODO: This hack can be removed once we fix the way the Python
# app bundles are generated so that they are not bundling and
# pointing to an otherwise unused and non-GUI-friendly version of
# Python on OS X.
def GetPyExecutable(self):
if 'wxMac' in wx.PlatformInfo:
# sys.executable will be wrong if running the demo from
# an app bundle. But the bundle is always using a system
# framework so just hardcode the path to it.
if sys.version[:3] == "2.4":
return '/usr/local/bin/pythonw', os.spawnl
else:
return '/usr/bin/pythonw', os.spawnl
else:
return sys.executable, os.spawnl
#----------------------------------------------------------------------
def runTest(frame, nb, log):

View File

@@ -51,6 +51,12 @@ _treeList = [
'GIFAnimationCtrl',
'HyperLinkCtrl',
'MultiSplitterWindow',
'Throbber',
'GetMouseState',
'FloatCanvas',
'AnalogClock',
'CheckListCtrlMixin',
'ComboTreeBox',
]),
# managed windows == things with a (optional) caption you can close
@@ -81,7 +87,6 @@ _treeList = [
# dialogs from libraries
('More Dialogs', [
'ImageBrowser',
'MultipleChoiceDialog',
'ScrolledMessageDialog',
]),
@@ -127,8 +132,9 @@ _treeList = [
]),
('Custom Controls', [
'AnalogClockWindow',
'AnalogClock',
'ColourSelect',
'ComboTreeBox',
'Editor',
'GenericButtons',
'GenericDirCtrl',
@@ -147,6 +153,7 @@ _treeList = [
#'RightTextCtrl', deprecated as we have wxTE_RIGHT now.
'Calendar',
'CalendarCtrl',
'CheckListCtrlMixin',
'ContextHelp',
'DatePickerCtrl',
'DynamicSashWindow',
@@ -160,12 +167,11 @@ _treeList = [
'HtmlWindow',
'HyperLinkCtrl',
'IntCtrl',
'MediaCtrl',
'MultiSplitterWindow',
'MVCTree',
'MaskedEditControls',
'MaskedNumCtrl',
'MimeTypesManager',
'MediaCtrl',
'MultiSplitterWindow',
'PyCrust',
'PyPlot',
'PyShell',
@@ -232,7 +238,9 @@ _treeList = [
'DrawXXXList',
'FileHistory',
'FontEnumerator',
'GLCanvas',
'Joystick',
'MimeTypesManager',
'MouseGestures',
'OGL',
'PrintFramework',
@@ -242,11 +250,6 @@ _treeList = [
'Unicode',
]),
# need libs not coming with the demo
('Samples using an external library', [
'GLCanvas',
]),
('Check out the samples dir too', [
]),
@@ -803,7 +806,8 @@ class DemoModules:
def LoadDict(self, modID):
if self.name != __name__:
source = self.modules[modID][1]
description = self.modules[modID][3]
#description = self.modules[modID][3]
description = self.modules[modID][2]
try:
self.modules[modID][0] = {}
@@ -1120,7 +1124,10 @@ class wxPythonDemo(wx.Frame):
icon = images.getWXPdemoIcon()
self.SetIcon(icon)
self.tbicon = DemoTaskBarIcon(self)
try:
self.tbicon = DemoTaskBarIcon(self)
except:
self.tbicon = None
wx.CallAfter(self.ShowTip)
@@ -1195,7 +1202,7 @@ class wxPythonDemo(wx.Frame):
shellItem = menu.Append(-1, 'Open Py&Shell Window\tF5',
'An interactive interpreter window with the demo app and frame objects in the namesapce')
menu.AppendSeparator()
helpItem = menu.Append(-1, '&About\tCtrl-H', 'wxPython RULES!!!')
helpItem = menu.Append(-1, '&About wxPython Demo', 'wxPython RULES!!!')
wx.App.SetMacAboutMenuItemId(helpItem.GetId())
self.Bind(wx.EVT_MENU, self.OnOpenShellWindow, shellItem)
@@ -1211,6 +1218,7 @@ class wxPythonDemo(wx.Frame):
self.SetMenuBar(self.mainmenu)
self.finddata = wx.FindReplaceData()
self.finddata.SetFlags(wx.FR_DOWN)
if 0:
# This is another way to set Accelerators, in addition to
@@ -1528,9 +1536,7 @@ class wxPythonDemo(wx.Frame):
self.nb.SetSelection(1)
self.finddlg = wx.FindReplaceDialog(self, self.finddata, "Find",
wx.FR_NOUPDOWN |
wx.FR_NOMATCHCASE |
wx.FR_NOWHOLEWORD)
wx.FR_NOMATCHCASE | wx.FR_NOWHOLEWORD)
self.finddlg.Show(True)
@@ -1543,13 +1549,22 @@ class wxPythonDemo(wx.Frame):
self.nb.SetSelection(1)
end = editor.GetLastPosition()
textstring = editor.GetRange(0, end).lower()
start = editor.GetSelection()[1]
findstring = self.finddata.GetFindString().lower()
loc = textstring.find(findstring, start)
backward = not (self.finddata.GetFlags() & wx.FR_DOWN)
if backward:
start = editor.GetSelection()[0]
loc = textstring.rfind(findstring, 0, start)
else:
start = editor.GetSelection()[1]
loc = textstring.find(findstring, start)
if loc == -1 and start != 0:
# string not found, start at beginning
start = 0
loc = textstring.find(findstring, start)
if backward:
start = end
loc = textstring.rfind(findstring, 0, start)
else:
start = 0
loc = textstring.find(findstring, start)
if loc == -1:
dlg = wx.MessageDialog(self, 'Find String Not Found',
'Find String Not Found in Demo File',
@@ -1612,7 +1627,8 @@ class wxPythonDemo(wx.Frame):
self.demoPage = None
self.codePage = None
self.mainmenu = None
self.tbicon.Destroy()
if self.tbicon is not None:
self.tbicon.Destroy()
self.Destroy()

View File

@@ -633,9 +633,11 @@ def RunStandalone():
app.MainLoop()
#----------------------------------------------------------------------------
import wx.lib.masked.maskededit as maskededit
# strip out module header used for pydoc:
demodoc = '\n'.join(maskededit.__doc__.split('\n')[2:])
overview = """<html>
<PRE><FONT SIZE=-1>
""" + maskededit.__doc__ + """
""" + demodoc + """
</FONT></PRE>
"""

View File

@@ -33,8 +33,8 @@ The controls at the top reconfigure the resulting control at the bottom.
groupcharlabel = wx.StaticText( panel,-1, "Grouping char:" )
self.groupchar = masked.TextCtrl(
panel, -1, value=',', mask='&', excludeChars = '-()',
formatcodes='F', emptyInvalid=True, validRequired=True
panel, -1, value=',', mask='*', includeChars = ' ', excludeChars = '-()0123456789',
formatcodes='F', emptyInvalid=False, validRequired=True
)
decimalcharlabel = wx.StaticText( panel,-1, "Decimal char:" )

View File

@@ -3,7 +3,17 @@ import wx
import wx.media
import os
from Main import opj
#----------------------------------------------------------------------
class StaticText(wx.StaticText):
"""
A StaticText that only updates the label if it has changed, to
help reduce potential flicker since these controls would be
updated very frequently otherwise.
"""
def SetLabel(self, label):
if label <> self.GetLabel():
wx.StaticText.SetLabel(self, label)
#----------------------------------------------------------------------
@@ -20,11 +30,14 @@ class TestPanel(wx.Panel):
self.Destroy()
raise
self.Bind(wx.media.EVT_MEDIA_LOADED, self.OnMediaLoaded)
btn1 = wx.Button(self, -1, "Load File")
self.Bind(wx.EVT_BUTTON, self.OnLoadFile, btn1)
btn2 = wx.Button(self, -1, "Play")
self.Bind(wx.EVT_BUTTON, self.OnPlay, btn2)
self.playBtn = btn2
btn3 = wx.Button(self, -1, "Pause")
self.Bind(wx.EVT_BUTTON, self.OnPause, btn3)
@@ -34,11 +47,12 @@ class TestPanel(wx.Panel):
slider = wx.Slider(self, -1, 0, 0, 0)
self.slider = slider
slider.SetMinSize((150, -1))
self.Bind(wx.EVT_SLIDER, self.OnSeek, slider)
self.st_size = wx.StaticText(self, -1, size=(100,-1))
self.st_len = wx.StaticText(self, -1, size=(100,-1))
self.st_pos = wx.StaticText(self, -1, size=(100,-1))
self.st_size = StaticText(self, -1, size=(100,-1))
self.st_len = StaticText(self, -1, size=(100,-1))
self.st_pos = StaticText(self, -1, size=(100,-1))
# setup the layout
@@ -54,8 +68,8 @@ class TestPanel(wx.Panel):
sizer.Add(self.st_pos, (3, 5))
self.SetSizer(sizer)
self.DoLoadFile(opj("data/testmovie.mpg"))
self.mc.Stop()
#self.DoLoadFile(os.path.abspath("data/testmovie.mpg"))
wx.CallAfter(self.DoLoadFile, os.path.abspath("data/testmovie.mpg"))
self.timer = wx.Timer(self)
self.Bind(wx.EVT_TIMER, self.OnTimer)
@@ -74,6 +88,8 @@ class TestPanel(wx.Panel):
def DoLoadFile(self, path):
self.playBtn.Disable()
noLog = wx.LogNull()
if not self.mc.Load(path):
wx.MessageBox("Unable to load %s: Unsupported format?" % path,
"ERROR",
@@ -82,12 +98,18 @@ class TestPanel(wx.Panel):
self.mc.SetBestFittingSize()
self.GetSizer().Layout()
self.slider.SetRange(0, self.mc.Length())
self.mc.Play()
def OnMediaLoaded(self, evt):
self.playBtn.Enable()
def OnPlay(self, evt):
self.mc.Play()
if not self.mc.Play():
wx.MessageBox("Unable to Play media : Unsupported format?",
"ERROR",
wx.ICON_ERROR | wx.OK)
else:
self.slider.SetRange(0, self.mc.Length())
def OnPause(self, evt):
self.mc.Pause()
@@ -149,4 +171,3 @@ if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])

View File

@@ -17,6 +17,13 @@ import pprint
import wx
import images
# helper function to make sure we don't convert unicode objects to strings
# or vice versa when converting lists and None values to text.
convert = str
if 'unicode' in wx.PlatformInfo:
convert = unicode
#----------------------------------------------------------------------------
class MimeTypesDemoPanel(wx.Panel):
@@ -199,8 +206,16 @@ class MimeTypesDemoPanel(wx.Panel):
mtypes = wx.TheMimeTypesManager.EnumAllFileTypes()
except wx.PyAssertionError:
mtypes = []
# TODO: On wxMac, EnumAllFileTypes produces tons of dupes, which
# causes quirky behavior because the list control doesn't expect
# dupes, and simply wastes space. So remove the dupes for now,
# then remove this hack when we fix EnumAllFileTypes on Mac.
mimes = []
for mt in mtypes:
self.mimelist.Append(mt)
if mt not in mimes:
self.mimelist.Append(mt)
mimes.append(mt)
# Do a lookup of *.wav for a starting position
self.OnLookup()
@@ -234,10 +249,10 @@ class MimeTypesDemoPanel(wx.Panel):
# Select the entered value in the list
if fileType:
if self.mimelist.FindString(str(fileType.GetMimeType())) != -1:
if self.mimelist.FindString(convert(fileType.GetMimeType())) != -1:
# Using CallAfter to ensure that GUI is ready before trying to
# select it (otherwise, it's selected but not visible)
wx.CallAfter(self.mimelist.SetSelection, self.mimelist.FindString(str(fileType.GetMimeType())))
wx.CallAfter(self.mimelist.SetSelection, self.mimelist.FindString(convert(fileType.GetMimeType())))
if fileType is None:
@@ -264,23 +279,23 @@ class MimeTypesDemoPanel(wx.Panel):
bmp = images.getNoIconBitmap()
self.icon.SetBitmap(bmp)
self.iconsource.SetValue(file)
self.iconoffset.SetValue(str(idx))
self.iconoffset.SetValue(convert(idx))
#------- MIME type
self.mimetype.SetValue(str(ft.GetMimeType()))
self.mimetype.SetValue(convert(ft.GetMimeType()))
#------- MIME types
self.mimetypes.SetValue(str(ft.GetMimeTypes()))
self.mimetypes.SetValue(convert(ft.GetMimeTypes()))
#------- Associated extensions
self.extensions.SetValue(str(ft.GetExtensions()))
self.extensions.SetValue(convert(ft.GetExtensions()))
#------- Description of file type
self.description.SetValue(str(ft.GetDescription()))
self.description.SetValue(convert(ft.GetDescription()))
#------- Prep a fake command line command
extList = ft.GetExtensions()
if extList:
ext = extList[0]
if ext[0] == ".": ext = ext[1:]
if len(ext) > 0 and ext[0] == ".": ext = ext[1:]
else:
ext = ""
@@ -289,11 +304,11 @@ class MimeTypesDemoPanel(wx.Panel):
#------- OPEN command
cmd = ft.GetOpenCommand(filename, mime)
self.opencommand.SetValue(str(cmd))
self.opencommand.SetValue(convert(cmd))
#------- PRINT command
cmd = ft.GetPrintCommand(filename, mime)
self.printcommand.SetValue(str(cmd))
self.printcommand.SetValue(convert(cmd))
#------- All commands
all = ft.GetAllCommands(filename, mime)

View File

@@ -31,8 +31,6 @@ class TestPanel(wx.Panel):
t = wx.StaticText(self, -1, "PopupMenu")
t.SetFont(bf)
box.Add(t, 0, wx.CENTER|wx.ALL, 5)
self.Bind(wx.EVT_RIGHT_UP, self.OnRightClick)
box.Add(wx.StaticLine(self, -1), 0, wx.EXPAND)
box.Add((10,20))
@@ -40,14 +38,15 @@ class TestPanel(wx.Panel):
t = wx.StaticText(self, -1, text)
t.SetFont(nf)
box.Add(t, 0, wx.CENTER|wx.ALL, 5)
t.Bind(wx.EVT_CONTEXT_MENU, self.OnContextMenu)
self.SetSizer(box)
self.Bind(wx.EVT_RIGHT_UP, self.OnRightClick)
self.Bind(wx.EVT_CONTEXT_MENU, self.OnContextMenu)
def OnRightClick(self, event):
self.log.WriteText("OnRightClick\n")
def OnContextMenu(self, event):
self.log.WriteText("OnContextMenu\n")
# only do this part the first time so the events are only bound once
#
@@ -97,7 +96,7 @@ class TestPanel(wx.Panel):
# Popup the menu. If an item is selected then its handler
# will be called before PopupMenu returns.
self.PopupMenu(menu, event.GetPosition())
self.PopupMenu(menu)
menu.Destroy()

View File

@@ -4,9 +4,6 @@ import ScrolledWindow
#----------------------------------------------------------------------
ID_Setup = wx.NewId()
ID_Preview = wx.NewId()
ID_Print = wx.NewId()
class MyPrintout(wx.Printout):
def __init__(self, canvas, log):
@@ -107,15 +104,15 @@ class TestPrintPanel(wx.Panel):
self.box.Add(self.canvas, 1, wx.GROW)
subbox = wx.BoxSizer(wx.HORIZONTAL)
btn = wx.Button(self, ID_Setup, "Print Setup")
self.Bind(wx.EVT_BUTTON, self.OnPrintSetup, btn)
btn = wx.Button(self, -1, "Page Setup")
self.Bind(wx.EVT_BUTTON, self.OnPageSetup, btn)
subbox.Add(btn, 1, wx.GROW | wx.ALL, 2)
btn = wx.Button(self, ID_Preview, "Print Preview")
btn = wx.Button(self, -1, "Print Preview")
self.Bind(wx.EVT_BUTTON, self.OnPrintPreview, btn)
subbox.Add(btn, 1, wx.GROW | wx.ALL, 2)
btn = wx.Button(self, ID_Print, "Print")
btn = wx.Button(self, -1, "Print")
self.Bind(wx.EVT_BUTTON, self.OnDoPrint, btn)
subbox.Add(btn, 1, wx.GROW | wx.ALL, 2)
@@ -125,22 +122,21 @@ class TestPrintPanel(wx.Panel):
self.SetSizer(self.box)
def OnPrintSetup(self, event):
data = wx.PrintDialogData(self.printData)
printerDialog = wx.PrintDialog(self, data)
printerDialog.GetPrintDialogData().SetSetupDialog(True)
printerDialog.ShowModal();
def OnPageSetup(self, evt):
psdd = wx.PageSetupDialogData(self.printData)
psdd.CalculatePaperSizeFromId()
dlg = wx.PageSetupDialog(self, psdd)
dlg.ShowModal()
# this makes a copy of the wx.PrintData instead of just saving
# a reference to the one inside the PrintDialogData that will
# be destroyed when the dialog is destroyed
self.printData = wx.PrintData( printerDialog.GetPrintDialogData().GetPrintData() )
printerDialog.Destroy()
self.printData = wx.PrintData( dlg.GetPageSetupData().GetPrintData() )
dlg.Destroy()
def OnPrintPreview(self, event):
self.log.WriteText("OnPrintPreview\n")
data = wx.PrintDialogData(self.printData)
printout = MyPrintout(self.canvas, self.log)
printout2 = MyPrintout(self.canvas, self.log)
@@ -150,12 +146,12 @@ class TestPrintPanel(wx.Panel):
self.log.WriteText("Houston, we have a problem...\n")
return
frame = wx.PreviewFrame(self.preview, self.frame, "This is a print preview")
pfrm = wx.PreviewFrame(self.preview, self.frame, "This is a print preview")
frame.Initialize()
frame.SetPosition(self.frame.GetPosition())
frame.SetSize(self.frame.GetSize())
frame.Show(True)
pfrm.Initialize()
pfrm.SetPosition(self.frame.GetPosition())
pfrm.SetSize(self.frame.GetSize())
pfrm.Show(True)

View File

@@ -22,7 +22,8 @@ class TestPanel(wx.Panel):
self.cmd = wx.TextCtrl(self, -1, 'python -u data/echo.py')
self.exBtn = wx.Button(self, -1, 'Execute')
self.out = wx.TextCtrl(self, -1, '', style=wx.TE_MULTILINE|wx.TE_READONLY)
self.out = wx.TextCtrl(self, -1, '',
style=wx.TE_MULTILINE|wx.TE_READONLY|wx.TE_RICH2)
self.inp = wx.TextCtrl(self, -1, '', style=wx.TE_PROCESS_ENTER)
self.sndBtn = wx.Button(self, -1, 'Send')

View File

@@ -45,9 +45,6 @@ def runTest(frame, nb, log):
overview = """\
A StaticBitmap control displays a bitmap.
The bitmap to be displayed should have a small number of colours, such as 16,
to avoid palette problems.
A bitmap can be derived from most image formats using the wx.Image class.
"""

View File

@@ -75,33 +75,33 @@ class PythonSTC(stc.StyledTextCtrl):
if self.fold_symbols == 0:
# Arrow pointing right for contracted folders, arrow pointing down for expanded
self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPEN, stc.STC_MARK_ARROWDOWN, "black", "black");
self.MarkerDefine(stc.STC_MARKNUM_FOLDER, stc.STC_MARK_ARROW, "black", "black");
self.MarkerDefine(stc.STC_MARKNUM_FOLDERSUB, stc.STC_MARK_EMPTY, "black", "black");
self.MarkerDefine(stc.STC_MARKNUM_FOLDERTAIL, stc.STC_MARK_EMPTY, "black", "black");
self.MarkerDefine(stc.STC_MARKNUM_FOLDEREND, stc.STC_MARK_EMPTY, "white", "black");
self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPENMID, stc.STC_MARK_EMPTY, "white", "black");
self.MarkerDefine(stc.STC_MARKNUM_FOLDERMIDTAIL, stc.STC_MARK_EMPTY, "white", "black");
self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPEN, stc.STC_MARK_ARROWDOWN, "black", "black")
self.MarkerDefine(stc.STC_MARKNUM_FOLDER, stc.STC_MARK_ARROW, "black", "black")
self.MarkerDefine(stc.STC_MARKNUM_FOLDERSUB, stc.STC_MARK_EMPTY, "black", "black")
self.MarkerDefine(stc.STC_MARKNUM_FOLDERTAIL, stc.STC_MARK_EMPTY, "black", "black")
self.MarkerDefine(stc.STC_MARKNUM_FOLDEREND, stc.STC_MARK_EMPTY, "white", "black")
self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPENMID, stc.STC_MARK_EMPTY, "white", "black")
self.MarkerDefine(stc.STC_MARKNUM_FOLDERMIDTAIL, stc.STC_MARK_EMPTY, "white", "black")
elif self.fold_symbols == 1:
# Plus for contracted folders, minus for expanded
self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPEN, stc.STC_MARK_MINUS, "white", "black");
self.MarkerDefine(stc.STC_MARKNUM_FOLDER, stc.STC_MARK_PLUS, "white", "black");
self.MarkerDefine(stc.STC_MARKNUM_FOLDERSUB, stc.STC_MARK_EMPTY, "white", "black");
self.MarkerDefine(stc.STC_MARKNUM_FOLDERTAIL, stc.STC_MARK_EMPTY, "white", "black");
self.MarkerDefine(stc.STC_MARKNUM_FOLDEREND, stc.STC_MARK_EMPTY, "white", "black");
self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPENMID, stc.STC_MARK_EMPTY, "white", "black");
self.MarkerDefine(stc.STC_MARKNUM_FOLDERMIDTAIL, stc.STC_MARK_EMPTY, "white", "black");
self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPEN, stc.STC_MARK_MINUS, "white", "black")
self.MarkerDefine(stc.STC_MARKNUM_FOLDER, stc.STC_MARK_PLUS, "white", "black")
self.MarkerDefine(stc.STC_MARKNUM_FOLDERSUB, stc.STC_MARK_EMPTY, "white", "black")
self.MarkerDefine(stc.STC_MARKNUM_FOLDERTAIL, stc.STC_MARK_EMPTY, "white", "black")
self.MarkerDefine(stc.STC_MARKNUM_FOLDEREND, stc.STC_MARK_EMPTY, "white", "black")
self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPENMID, stc.STC_MARK_EMPTY, "white", "black")
self.MarkerDefine(stc.STC_MARKNUM_FOLDERMIDTAIL, stc.STC_MARK_EMPTY, "white", "black")
elif self.fold_symbols == 2:
# Like a flattened tree control using circular headers and curved joins
self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPEN, stc.STC_MARK_CIRCLEMINUS, "white", "#404040");
self.MarkerDefine(stc.STC_MARKNUM_FOLDER, stc.STC_MARK_CIRCLEPLUS, "white", "#404040");
self.MarkerDefine(stc.STC_MARKNUM_FOLDERSUB, stc.STC_MARK_VLINE, "white", "#404040");
self.MarkerDefine(stc.STC_MARKNUM_FOLDERTAIL, stc.STC_MARK_LCORNERCURVE, "white", "#404040");
self.MarkerDefine(stc.STC_MARKNUM_FOLDEREND, stc.STC_MARK_CIRCLEPLUSCONNECTED, "white", "#404040");
self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPENMID, stc.STC_MARK_CIRCLEMINUSCONNECTED, "white", "#404040");
self.MarkerDefine(stc.STC_MARKNUM_FOLDERMIDTAIL, stc.STC_MARK_TCORNERCURVE, "white", "#404040");
self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPEN, stc.STC_MARK_CIRCLEMINUS, "white", "#404040")
self.MarkerDefine(stc.STC_MARKNUM_FOLDER, stc.STC_MARK_CIRCLEPLUS, "white", "#404040")
self.MarkerDefine(stc.STC_MARKNUM_FOLDERSUB, stc.STC_MARK_VLINE, "white", "#404040")
self.MarkerDefine(stc.STC_MARKNUM_FOLDERTAIL, stc.STC_MARK_LCORNERCURVE, "white", "#404040")
self.MarkerDefine(stc.STC_MARKNUM_FOLDEREND, stc.STC_MARK_CIRCLEPLUSCONNECTED, "white", "#404040")
self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPENMID, stc.STC_MARK_CIRCLEMINUSCONNECTED, "white", "#404040")
self.MarkerDefine(stc.STC_MARKNUM_FOLDERMIDTAIL, stc.STC_MARK_TCORNERCURVE, "white", "#404040")
elif self.fold_symbols == 3:
# Like a flattened tree control using square headers
@@ -286,7 +286,7 @@ class PythonSTC(stc.StyledTextCtrl):
for lineNum in range(lineCount):
if self.GetFoldLevel(lineNum) & stc.STC_FOLDLEVELHEADERFLAG:
expanding = not self.GetFoldExpanded(lineNum)
break;
break
lineNum = 0
@@ -342,7 +342,7 @@ class PythonSTC(stc.StyledTextCtrl):
else:
line = self.Expand(line, False, force, visLevels-1)
else:
line = line + 1;
line = line + 1
return line

View File

@@ -1,6 +1,5 @@
import os
import wx
import wx.lib.printout as printout
@@ -9,6 +8,7 @@ import wx.lib.printout as printout
buttonDefs = {
814 : ('PreviewWide', 'Preview print of a wide table'),
815 : ('PreviewNarrow', 'Preview print of a narrow table with color highlights'),
816 : ('PreviewText', 'Preview print of a text file'),
818 : ('OnPreviewMatrix', 'Preview print of a narrow column grid without a table header'),
817 : ('PreviewLine', 'Preview print to demonstrate the use of line breaks'),
819 : ('PrintWide', 'Direct print (no preview) of a wide table'),
@@ -150,6 +150,17 @@ class TablePanel(wx.Panel):
prt.SetFooter()
prt.Preview()
def PreviewText(self):
prt = printout.PrintTable(self.frame)
prt.SetHeader("PROCLAMATION")
file = open('data/proclamation.txt')
data = []
for txt in file:
data.append(txt.strip())
file.close()
prt.data = data
prt.Preview()
def PrintWide(self):
self.ReadData()
prt = printout.PrintTable(self.frame)

View File

@@ -69,6 +69,13 @@ class TestPanel(wx.Panel):
pointSize = 8, family = wx.DEFAULT, style = wx.NORMAL, weight = wx.BOLD
))
self.customThrobber = \
throb.Throbber(self, -1, images, size=(36, 36),
frameDelay = 0.1,
rest = 4,
sequence = [ 1, 5, 2, 7, 3, 6, 4, 4, 4, 4, 7, 2, 2, 0 ]
)
box = wx.BoxSizer(wx.VERTICAL)
sizer = wx.GridBagSizer()
box.Add(sizer, 1, wx.EXPAND|wx.ALL, 5)
@@ -90,6 +97,18 @@ class TestPanel(wx.Panel):
row += 1
# Add custom throbber to sizer.
row += 2
sizer.Add(
self.customThrobber, (row, 0), (1, 1),
flag = wx.ALIGN_CENTER|wx.ALL, border=2
)
sizer.Add(
wx.StaticText(self, -1, 'with custom & manual sequences'),
(row, 1), flag = wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_LEFT
)
# start and stop buttons
startButton = wx.Button(self, -1, "Start")
self.Bind(wx.EVT_BUTTON, self.OnStartAnimation, startButton)
@@ -104,9 +123,54 @@ class TestPanel(wx.Panel):
])
sizer.Add(
buttonBox, (len(self.throbbers) + 3, 0), (1, 3), flag = wx.ALIGN_CENTER
buttonBox, (len(self.throbbers) + 2, 0), (1, 3), flag = wx.ALIGN_CENTER
)
# Buttoms for the custom throbber.
nextButton = wx.Button(self, -1, "Next")
self.Bind(wx.EVT_BUTTON, self.OnNext, nextButton)
prevButton = wx.Button(self, -1, "Previous")
self.Bind(wx.EVT_BUTTON, self.OnPrevious, prevButton)
incButton = wx.Button(self, -1, "Increment")
self.Bind(wx.EVT_BUTTON, self.OnIncrement, incButton)
decButton = wx.Button(self, -1, "Decrement")
self.Bind(wx.EVT_BUTTON, self.OnDecrement, decButton)
revButton = wx.Button(self, -1, "Reverse")
self.Bind(wx.EVT_BUTTON, self.OnReverse, revButton)
restButton = wx.Button(self, -1, "Rest")
self.Bind(wx.EVT_BUTTON, self.OnRest, restButton)
startButton = wx.Button(self, -1, "Start")
self.Bind(wx.EVT_BUTTON, self.OnStart, startButton)
stopButton = wx.Button(self, -1, "Stop")
self.Bind(wx.EVT_BUTTON, self.OnStop, stopButton)
customBox1 = wx.BoxSizer(wx.HORIZONTAL)
customBox1.AddMany([
(nextButton, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 5),
(prevButton, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 5),
(incButton, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 5),
(decButton, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 5),
(revButton, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 5),
])
customBox2 = wx.BoxSizer(wx.HORIZONTAL)
customBox2.AddMany([
(restButton, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 5),
(startButton, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 5),
(stopButton, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 5),
])
sizer.Add( customBox1, (len(self.throbbers) + 5, 0), (1, 3), flag = wx.ALIGN_CENTER )
sizer.Add( customBox2, (len(self.throbbers) + 6, 0), (1, 3), flag = wx.ALIGN_CENTER )
# Layout.
self.SetSizer(box)
self.SetAutoLayout(True)
self.Layout()
@@ -130,6 +194,30 @@ class TestPanel(wx.Panel):
for t in self.throbbers.keys():
self.throbbers[t]['throbber'].Rest()
def OnNext(self, event):
self.customThrobber.Next()
def OnPrevious(self, event):
self.customThrobber.Previous()
def OnIncrement(self, event):
self.customThrobber.Increment()
def OnDecrement(self, event):
self.customThrobber.Decrement()
def OnReverse(self, event):
self.customThrobber.Reverse()
def OnRest(self, event):
self.customThrobber.Rest()
def OnStart(self, event):
self.customThrobber.Start()
def OnStop(self, event):
self.customThrobber.Stop()
def ShutdownDemo(self):
for t in self.throbbers.keys():
self.throbbers[t]['throbber'].Rest()

View File

@@ -36,6 +36,8 @@ class TestToolBar(wx.Frame):
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)
tb.SetToolBitmapSize(tsize)
tb.AddSimpleTool(10, new_bmp, "New", "Long help for 'New'")
#tb.AddLabelTool(10, "New", new_bmp, shortHelp="New", longHelp="Long help for 'New'")

View File

@@ -175,7 +175,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.getWizTest1Bitmap())
wizard = wiz.Wizard(self, -1, "Simple Wizard", images.getWizTest1Bitmap())
wizard = wiz.Wizard(self, -1, "Dynamic Wizard", images.getWizTest1Bitmap())
page1 = TitledPage(wizard, "Page 1")
page2 = SkipNextPage(wizard, "Page 2")

View File

@@ -71,11 +71,11 @@ class MyCustomPanelXmlHandler(xrc.XmlResourceHandler):
def __init__(self):
xrc.XmlResourceHandler.__init__(self)
# Specify the styles recognized by objects of this type
self.AddStyle("wxNO_3D", wx.NO_3D);
self.AddStyle("wxTAB_TRAVERSAL", wx.TAB_TRAVERSAL);
self.AddStyle("wxWS_EX_VALIDATE_RECURSIVELY", wx.WS_EX_VALIDATE_RECURSIVELY);
self.AddStyle("wxCLIP_CHILDREN", wx.CLIP_CHILDREN);
self.AddWindowStyles();
self.AddStyle("wxNO_3D", wx.NO_3D)
self.AddStyle("wxTAB_TRAVERSAL", wx.TAB_TRAVERSAL)
self.AddStyle("wxWS_EX_VALIDATE_RECURSIVELY", wx.WS_EX_VALIDATE_RECURSIVELY)
self.AddStyle("wxCLIP_CHILDREN", wx.CLIP_CHILDREN)
self.AddWindowStyles()
# This method and the next one are required for XmlResourceHandlers
def CanHandle(self, node):

View File

@@ -0,0 +1,115 @@
EMANCIPATION PROCLAMATION:
By the President of the United States of America:
A PROCLAMATION
Whereas on the 22nd day of September, A.D. 1862, a proclamation
was issued by the President of the United States, containing,
among other things, the following, to wit:
"That on the 1st day of January, A.D. 1863, all persons held as
slaves within any State or designated part of a State the people
whereof shall then be in rebellion against the United States shall
be then, thenceforward, and forever free; and the executive
government of the United States, including the military and naval
authority thereof, will recognize and maintain the freedom of such
persons and will do no act or acts to repress such persons, or any
of them, in any efforts they may make for their actual freedom.
"That the executive will on the 1st day of January aforesaid,
by proclamation, designate the States and parts of States, if any,
in which the people thereof, respectively, shall then be in
rebellion against the United States; and the fact that any State
or the people thereof shall on that day be in good faith
represented in the Congress of the United States by members
chosen thereto at elections wherein a majority of the qualified
voters of such States shall have participated shall, in the
absence of strong countervailing testimony, be deemed conclusive
evidence that such State and the people thereof are not then
in rebellion against the United States."
Now, therefore, I, Abraham Lincoln, President of the United
States, by virtue of the power in me vested as Commander-In-Chief
of the Army and Navy of the United States in time of actual armed
rebellion against the authority and government of the United States,
and as a fit and necessary war measure for supressing said
rebellion, do, on this 1st day of January, A.D. 1863, and in
accordance with my purpose so to do, publicly proclaimed for the
full period of one hundred days from the first day above mentioned,
order and designate as the States and parts of States wherein the
people thereof, respectively, are this day in rebellion against
the United States the following, to wit:
Arkansas, Texas, Louisiana (except the parishes of St. Bernard,
Palquemines, Jefferson, St. John, St. Charles, St. James, Ascension,
Assumption, Terrebone, Lafourche, St. Mary, St. Martin, and Orleans,
including the city of New Orleans), Mississippi, Alabama, Florida,
Georgia, South Carolina, North Carolina, and Virginia (except the
forty-eight counties designated as West Virginia, and also the
counties of Berkeley, Accomac, Morthhampton, Elizabeth City, York,
Princess Anne, and Norfolk, including the cities of Norfolk and
Portsmouth), and which excepted parts are for the present left
precisely as if this proclamation were not issued.
And by virtue of the power and for the purpose aforesaid, I do
order and declare that all persons held as slaves within said
designated States and parts of States are, and henceforward shall
be, free; and that the Executive Government of the United States,
including the military and naval authorities thereof, will
recognize and maintain the freedom of said persons.
And I hereby enjoin upon the people so declared to be free to
abstain from all violence, unless in necessary self-defence; and
I recommend to them that, in all case when allowed, they labor
faithfully for reasonable wages.
And I further declare and make known that such persons of
suitable condition will be received into the armed service of
the United States to garrison forts, positions, stations, and
other places, and to man vessels of all sorts in said service.
And upon this act, sincerely believed to be an act of justice,
warranted by the Constitution upon military necessity, I invoke
the considerate judgment of mankind and the gracious favor
of Almighty God.
(signed)
ABRAHAM LINCOLN
-------------------------------------
On Jan. 1, 1863, U.S. President Abraham Lincoln declared free
all slaves residing in territory in rebellion against the federal
government. This Emancipation Proclamation actually freed few
people. It did not apply to slaves in border states fighting on
the Union side; nor did it affect slaves in southern areas already
under Union control. Naturally, the states in rebellion did not
act on Lincoln's order. But the proclamation did show Americans--
and the world--that the civil war was now being fought to end slavery.
Lincoln had been reluctant to come to this position. A believer
in white supremacy, he initially viewed the war only in terms of
preserving the Union. As pressure for abolition mounted in
Congress and the country, however, Lincoln became more sympathetic
to the idea. On Sept. 22, 1862, he issued a preliminary proclamation
announcing that emancipation would become effective on Jan. 1, 1863,
in those states still in rebellion. Although the Emancipation
Proclamation did not end slavery in America--this was achieved
by the passage of the 13TH Amendment to the Constitution on Dec.
18, 1865--it did make that accomplishment a basic war goal and
a virtual certainty.
DOUGLAS T. MILLER
Bibliography: Commager, Henry Steele, The Great Proclamation
(1960); Donovan, Frank, Mr. Lincoln's Proclamation (1964);
Franklin, John Hope, ed., The Emancipation Proclamation (1964).
-------------------------------------
Prepared by Gerald Murphy (The Cleveland Free-Net - aa300)
Distributed by the Cybercasting Services Division of the
National Public Telecomputing Network (NPTN).
Permission is hereby granted to download, reprint, and/or otherwise
redistribute this file, provided appropriate point of origin
credit is given to the preparer(s) and the National Public
Telecomputing Network.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -21,7 +21,7 @@ import wx # This module uses the new wx namespace
import sys, os
# stuff for debugging
print "wx.VERSION_STRING = ", wx.VERSION_STRING
print "wx.VERSION_STRING = %s (%s)" % (wx.VERSION_STRING, wx.USE_UNICODE and 'unicode' or 'ansi')
print "pid:", os.getpid()
##raw_input("Press Enter...")