while x < sz.width:
y = -dy
while y < sz.height:
- dc.DrawBitmap(self.bg_bmp, x, y)
+ dc.DrawBitmap(self.bg_bmp, (x, y))
y = y + h
x = x + w
for line in range(max(0,start), min(stop,numColours)):
clr = colours[line]
y = (line+1) * self.lineHeight + 2
- dc.DrawText(clr, self.cellWidth, y)
+ dc.DrawText(clr, (self.cellWidth, y))
brush = wxBrush(clr, wxSOLID)
dc.SetBrush(brush)
- dc.DrawRectangle(12 * self.cellWidth, y, 6 * self.cellWidth, self.textHeight)
+ dc.DrawRectangle((12 * self.cellWidth, y),
+ (6 * self.cellWidth, self.textHeight))
dc.EndDrawing()
from wxPython.wx import *
-from wxPython.help import *
#----------------------------------------------------------------------
# We first have to set an application-wide help provider. Normally you
s = wxBoxSizer(wxHORIZONTAL)
s.Add(cBtn, 0, wxALL, 5)
s.Add(cBtnText, 0, wxALL, 5)
- sizer.Add(20,20)
+ sizer.Add((20,20))
sizer.Add(s)
text = wxTextCtrl(self, -1, "Each sub-window can have its own help message",
size=(240, 60), style = wxTE_MULTILINE)
text.SetHelpText("This is my very own help message. This is a really long long long long long long long long long long long long long long long long long long long long message!")
- sizer.Add(20,20)
+ sizer.Add((20,20))
sizer.Add(text)
text = wxTextCtrl(self, -1, "You can also intercept the help event if you like. Watch the log window when you click here...",
size=(240, 60), style = wxTE_MULTILINE)
text.SetHelpText("Yet another context help message.")
- sizer.Add(20,20)
+ sizer.Add((20,20))
sizer.Add(text)
EVT_HELP(text, text.GetId(), self.OnCtxHelp)
text = wxTextCtrl(self, -1, "This one displays the tip itself...",
size=(240, 60), style = wxTE_MULTILINE)
- sizer.Add(20,20)
+ sizer.Add((20,20))
sizer.Add(text)
EVT_HELP(text, text.GetId(), self.OnCtxHelp2)
dc.SetPen(wxPen(wxBLUE, 3))
for line in self.lines:
for coords in line:
- apply(dc.DrawLine, coords)
+ dc.DrawLineXY(*coords)
dc.EndDrawing()
dc.SetPen(wxPen(wxBLUE, 3))
coords = (self.x, self.y) + event.GetPositionTuple()
self.curLine.append(coords)
- apply(dc.DrawLine, coords)
+ dc.DrawLineXY(*coords)
self.x, self.y = event.GetPositionTuple()
dc.EndDrawing()
dc.SetPen(wxPen(wxRED, 3))
for line in self.lines:
for coords in line:
- apply(dc.DrawLine, coords)
+ dc.DrawLineXY(*coords)
dc.EndDrawing()
#----------------------------------------------------------------------
rbox.Add(rb2)
box.Add(text1, 0, wxALL, 10)
box.Add(rbox, 0, wxALIGN_CENTER)
- box.Add(10,90)
+ box.Add((10,90))
box.Add(text2, 0, wxALL, 10)
sizer.Add(box)
colors = []
for i in range(num):
c = whrandom.choice(colours)
- colors.append(wxNamedColor(c))
+ colors.append(wxNamedColour(c))
return colors
message2 = wxStaticText(self, -1, txt)
message2.SetFont(f1)
- targetPanel = Tile(self, log, bgColor=wxColor(80,10,10), active=0)
+ targetPanel = Tile(self, log, bgColor=wxColour(80,10,10), active=0)
buttonPanel = wxPanel(self ,-1)
sizer = wxBoxSizer(wxHORIZONTAL)
target = targetPanel.tile
- sizer.Add(0,0,1)
+ sizer.Add((0,0), 1)
for factor in [0.2, 0.3, 0.4, 0.5, 0.6, 0.7]:
sizer.Add(Tile(buttonPanel, log, factor-0.05, target), 0, wxALIGN_CENTER)
- sizer.Add(0,0,1)
+ sizer.Add((0,0),1)
sizer.Add(Tile(buttonPanel, log, factor, target), 0, wxALIGN_CENTER)
- sizer.Add(0,0,1)
+ sizer.Add((0,0),1)
buttonPanel.SetAutoLayout(1)
buttonPanel.SetSizer(sizer)
its border color in response to certain mouse
events over its contained 'InnerTile'.
"""
- normal = wxColor(150,150,150)
- active = wxColor(250,245,245)
- hover = wxColor(210,220,210)
+ normal = wxColour(150,150,150)
+ active = wxColour(250,245,245)
+ hover = wxColour(210,220,210)
def __init__(self, parent, log, factor=1, thingToWatch=None, bgColor=None, active=1, size=(38,38), borderWidth=3):
wxPanel.__init__(self, parent, -1, size=size, style=wxCLIP_CHILDREN)
class InnerTile(wxPanel):
- IDLE_COLOR = wxColor( 80, 10, 10)
- START_COLOR = wxColor(200, 70, 50)
- FINAL_COLOR = wxColor( 20, 80,240)
- OFF_COLOR = wxColor(185,190,185)
+ IDLE_COLOR = wxColour( 80, 10, 10)
+ START_COLOR = wxColour(200, 70, 50)
+ FINAL_COLOR = wxColour( 20, 80,240)
+ OFF_COLOR = wxColour(185,190,185)
# Some pre-computation.
DELTAS = map(lambda a,b: b-a, START_COLOR.Get(), FINAL_COLOR.Get())
START_COLOR_TUPLE = START_COLOR.Get()
r = InnerTile.START_COLOR_TUPLE[0] + (InnerTile.DELTAS[0] * percent)
g = InnerTile.START_COLOR_TUPLE[1] + (InnerTile.DELTAS[1] * percent)
b = InnerTile.START_COLOR_TUPLE[2] + (InnerTile.DELTAS[2] * percent)
- self.setColor(wxColor(int(r), int(g), int(b)))
+ self.setColor(wxColour(int(r), int(g), int(b)))
self.SetAutoLayout(True)
EVT_BUTTON(self, 100, self.OnButton)
- self.panelA = wxWindow(self, -1, wxPyDefaultPosition, wxPyDefaultSize, wxSIMPLE_BORDER)
+ self.panelA = wxWindow(self, -1, style=wxSIMPLE_BORDER)
self.panelA.SetBackgroundColour(wxBLUE)
self.panelA.SetConstraints(Layoutf('t=t10#1;l=l10#1;b=b10#1;r%r50#1',(self,)))
- self.panelB = wxWindow(self, -1, wxPyDefaultPosition, wxPyDefaultSize, wxSIMPLE_BORDER)
+ self.panelB = wxWindow(self, -1, style=wxSIMPLE_BORDER)
self.panelB.SetBackgroundColour(wxRED)
self.panelB.SetConstraints(Layoutf('t=t10#1;r=r10#1;b%b30#1;l>10#2', (self,self.panelA)))
- self.panelC = wxWindow(self, -1, wxPyDefaultPosition, wxPyDefaultSize, wxSIMPLE_BORDER)
+ self.panelC = wxWindow(self, -1, style=wxSIMPLE_BORDER)
self.panelC.SetBackgroundColour(wxWHITE)
self.panelC.SetConstraints(Layoutf('t_10#3;r=r10#1;b=b10#1;l>10#2', (self,self.panelA,self.panelB)))
b = wxButton(self.panelB, 100, ' Panel B ')
b.SetConstraints(Layoutf('t=t2#1;r=r4#1;h*;w*', (self.panelB,)))
- self.panelD = wxWindow(self.panelC, -1, wxPyDefaultPosition, wxPyDefaultSize, wxSIMPLE_BORDER)
+ self.panelD = wxWindow(self.panelC, -1, style=wxSIMPLE_BORDER)
self.panelD.SetBackgroundColour(wxGREEN)
self.panelD.SetConstraints(Layoutf('b%h50#1;r%w50#1;h=h#2;w=w#2', (self.panelC, b)))
'wxIntCtrl',
'wxMimeTypesManager',
'wxMaskedNumCtrl',
+ 'wxScrolledPanel',
'wxStyledTextCtrl_1',
'wxStyledTextCtrl_2',
'wxTimeCtrl',
#-------------------------------------------
self.canvas.DoDrawing(dc, True)
- dc.DrawText("Page: %d" % page, marginX/2, maxY-marginY)
+ dc.DrawText("Page: %d" % page, (marginX/2, maxY-marginY))
return True
box.Add(wxButton(win, 1010, "one"), 0, wxEXPAND)
box.Add(wxButton(win, 1010, "two"), 0, wxEXPAND)
box.Add(wxButton(win, 1010, "three"), 0, wxEXPAND)
- box.Add(60, 20, 0, wxEXPAND)
+ box.Add((60, 20), 0, wxEXPAND)
box.Add(wxButton(win, 1010, "five"), 1, wxEXPAND)
return box
def makeSimpleBox8(win):
box = wxBoxSizer(wxVERTICAL)
box.Add(wxButton(win, 1010, "one"), 0, wxEXPAND)
- box.Add(0,0, 1)
+ box.Add((0,0), 1)
box.Add(wxButton(win, 1010, "two"), 0, wxALIGN_CENTER)
- box.Add(0,0, 1)
+ box.Add((0,0), 1)
box.Add(wxButton(win, 1010, "three"), 0, wxEXPAND)
box.Add(wxButton(win, 1010, "four"), 0, wxEXPAND)
# box.Add(wxButton(win, 1010, "five"), 1, wxEXPAND)
dc.SetBackground(wxBrush(self.GetBackgroundColour()))
dc.Clear()
dc.SetPen(wxPen(wxBLACK, 3, wxSOLID))
- dc.DrawLine(self.linePos, 0, self.linePos, size.height-10)
+ dc.DrawLine((self.linePos, 0), (self.linePos, size.height-10))
bh = ypos = self.barHeight
for x in range(len(self.values)):
label, val = self.values[x]
- dc.DrawText(label, 5, ypos)
+ dc.DrawText(label, (5, ypos))
if val:
color = self.colors[ x % len(self.colors) ]
dc.SetPen(wxPen(color))
dc.SetBrush(wxBrush(color))
- dc.DrawRectangle(self.linePos+3, ypos, val, bh)
+ dc.DrawRectangle((self.linePos+3, ypos), (val, bh))
ypos = ypos + 2*bh
if ypos > size.height-10:
wdc = wxPaintDC(self)
wdc.BeginDrawing()
- wdc.Blit(0,0, size.width, size.height, dc, 0,0)
+ wdc.Blit((0,0), size, dc, (0,0))
wdc.EndDrawing()
dc.SelectObject(wxNullBitmap)
text.SetForegroundColour(wxBLUE)
outsideSizer.Add(text, 0, wxEXPAND|wxALL, 5)
outsideSizer.Add(wxStaticLine(self, -1), 0, wxEXPAND)
- outsideSizer.Add(20,20)
+ outsideSizer.Add((20,20))
self.SetFont(wxFont(10, wxSWISS, wxNORMAL, wxBOLD, False))
inSizer = wxFlexGridSizer(2, 2, 5, 5)
inSizer.AddGrowableCol(0)
- inSizer.Add(20,20)
- inSizer.Add(20,20)
+ inSizer.Add((20,20))
+ inSizer.Add((20,20))
inSizer.Add(wxStaticText(self, -1,
"Drag URLs from your browser to\nthis window:",
style = wxALIGN_RIGHT),
self.SetAssertMode(assertMode)
- frame = wx.Frame(None, -1, "RunDemo: " + self.name, pos=(50,50), size=(0,0),
+ frame = wx.Frame(None, -1, "RunDemo: " + self.name, pos=(50,50), size=(200,100),
style=wx.NO_FULL_REPAINT_ON_RESIZE|wx.DEFAULT_FRAME_STYLE)
frame.CreateStatusBar()
menuBar = wx.MenuBar()
fgs.AddWindow(cb, 0, wxALIGN_CENTRE|wxALL, 5)
EVT_CHECKBOX(self, cb.GetId(), self.OnUseCustom)
- fgs.AddSpacer(10, 10, 0, wxALIGN_CENTRE|wxALL, 5)
- fgs.AddSpacer(10, 10, 0, wxALIGN_CENTRE|wxALL, 5)
- fgs.AddSpacer(10, 10, 0, wxALIGN_CENTRE|wxALL, 5)
+ fgs.Add((10, 10), 0, wxALIGN_CENTRE|wxALL, 5)
+ fgs.Add((10, 10), 0, wxALIGN_CENTRE|wxALL, 5)
+ fgs.Add((10, 10), 0, wxALIGN_CENTRE|wxALL, 5)
box = wxBoxSizer(wxVERTICAL)
bmp = wxEmptyBitmap(16,16)
#---------------------------------------------------------------------------
-def main():
- app = MyApp(0)
- app.MainLoop()
-
-
-if __name__ == '__main__':
- main()
-
-
-#---------------------------------------------------------------------------
-
def runTest(frame, nb, log):
win = TestPanel(nb, log, frame)
return win
by Lorne White
"""
+
+
+
+
+if __name__ == '__main__':
+ import sys,os
+ import run
+ run.main(['', os.path.basename(sys.argv[0])])
+
from wxPython.wx import *
from wxPython.calendar import *
-from wxPython.utils import *
+
#----------------------------------------------------------------------
memDC = wxMemoryDC()
memDC.SelectObject(self.bmp)
- dc.Blit(self.pos.x, self.pos.y,
- self.bmp.GetWidth(), self.bmp.GetHeight(),
- memDC, 0, 0, op, True)
+ dc.Blit((self.pos.x, self.pos.y),
+ (self.bmp.GetWidth(), self.bmp.GetHeight()),
+ memDC, (0, 0), op, True)
return True
else:
dc.Clear()
dc.SetTextForeground(wxRED)
dc.SetFont(font)
- dc.DrawText(text, 0, 0)
+ dc.DrawText(text, (0, 0))
dc.SelectObject(wxNullBitmap)
mask = wxMaskColour(bmp, bg_colour)
bmp.SetMask(mask)
while x < sz.width:
y = 0
while y < sz.height:
- dc.DrawBitmap(self.bg_bmp, x, y)
+ dc.DrawBitmap(self.bg_bmp, (x, y))
y = y + h
x = x + w
from Main import opj
+##wxTrap()
+
#----------------------------------------------------------------------
# This shows how to catch the OnLinkClicked non-event. (It's a virtual
grid.AddWindow( self.max, 0, wxALIGN_LEFT|wxALL, 5 )
grid.AddWindow( self.limit_target, 0, wxALIGN_LEFT|wxALL, 5 )
- grid.AddSpacer( 20, 0, 0, wxALIGN_LEFT|wxALL, 5 )
+ grid.AddSpacer( (20, 0), 0, wxALIGN_LEFT|wxALL, 5 )
grid.AddWindow( self.allow_none, 0, wxALIGN_LEFT|wxALL, 5 )
- grid.AddSpacer( 20, 0, 0, wxALIGN_LEFT|wxALL, 5 )
+ grid.AddSpacer( (20, 0), 0, wxALIGN_LEFT|wxALL, 5 )
grid.AddWindow( self.allow_long, 0, wxALIGN_LEFT|wxALL, 5 )
- grid.AddSpacer( 20, 0, 0, wxALIGN_LEFT|wxALL, 5 )
+ grid.AddSpacer( (20, 0), 0, wxALIGN_LEFT|wxALL, 5 )
- grid.AddSpacer( 20, 0, 0, wxALIGN_LEFT|wxALL, 5 )
- grid.AddSpacer( 20, 0, 0, wxALIGN_LEFT|wxALL, 5 )
+ grid.AddSpacer( (20, 0), 0, wxALIGN_LEFT|wxALL, 5 )
+ grid.AddSpacer( (20, 0), 0, wxALIGN_LEFT|wxALL, 5 )
grid.AddWindow( label, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5 )
grid.AddWindow( self.target_ctl, 0, wxALIGN_LEFT|wxALL, 5 )
# make an interesting background...
dc.SetPen(wxMEDIUM_GREY_PEN)
for i in range(100):
- dc.DrawLine(0,i*10,i*10,0)
+ dc.DrawLine((0,i*10), (i*10,0))
# draw raw image, mask, and masked images
- dc.DrawText('original image', 0,0)
- dc.DrawBitmap(self.bmp_nomask, 0,20, 0)
- dc.DrawText('with colour mask', 0,100)
- dc.DrawBitmap(self.bmp_withcolourmask, 0,120, 1)
- dc.DrawText('the mask image', 0,200)
- dc.DrawBitmap(self.bmp_themask, 0,220, 0)
- dc.DrawText('masked image', 0,300)
- dc.DrawBitmap(self.bmp_withmask, 0,320, 1)
+ dc.DrawText('original image', (0,0))
+ dc.DrawBitmap(self.bmp_nomask, (0,20), 0)
+ dc.DrawText('with colour mask', (0,100))
+ dc.DrawBitmap(self.bmp_withcolourmask, (0,120), 1)
+ dc.DrawText('the mask image', (0,200))
+ dc.DrawBitmap(self.bmp_themask, (0,220), 0)
+ dc.DrawText('masked image', (0,300))
+ dc.DrawBitmap(self.bmp_withmask, (0,320), 1)
cx,cy = self.bmp_themask.GetWidth(), self.bmp_themask.GetHeight()
i = 0
for text, code in logicList:
x,y = 120+150*(i%4), 20+100*(i/4)
- dc.DrawText(text, x, y-20)
+ dc.DrawText(text, (x, y-20))
mdc.SelectObject(self.bmp_withcolourmask)
- dc.Blit(x,y, cx,cy, mdc, 0,0, code, True)
+ dc.Blit((x,y), (cx,cy), mdc, (0,0), code, True)
i = i + 1
desc.SetForegroundColour("Blue")
vbox.Add(desc, 0, wxALIGN_LEFT|wxALL, 5)
vbox.Add(wxStaticLine(self, -1, size=(1024,-1)), 0, wxALL, 5)
- vbox.AddSpacer(20,20)
+ vbox.Add((20,20))
words = text.split()
panel3.SetupScrolling()
hbox = wxBoxSizer(wxHORIZONTAL)
- hbox.AddSpacer(20,20)
+ hbox.Add((20,20))
hbox.Add(panel1, 0)
- hbox.AddSpacer(40, 10)
+ hbox.Add((40, 10))
vbox2 = wxBoxSizer(wxVERTICAL)
vbox2.Add(panel2, 0)
- vbox2.AddSpacer(20, 50)
+ vbox2.Add((20, 50))
vbox2.Add(panel3, 0)
- vbox2.AddSpacer(20, 10)
+ vbox2.Add((20, 10))
hbox.Add(vbox2)
vbox.AddSizer(hbox, 0)
self.target_ctrl = wxTimeCtrl( self, -1, name="new" )
grid2 = wxFlexGridSizer( 0, 2, 0, 0 )
- grid2.Add( 20, 0, 0, wxALIGN_LEFT|wxALL, 5 )
- grid2.Add( 20, 0, 0, wxALIGN_LEFT|wxALL, 5 )
+ grid2.Add( (20, 0), 0, wxALIGN_LEFT|wxALL, 5 )
+ grid2.Add( (20, 0), 0, wxALIGN_LEFT|wxALL, 5 )
grid2.Add( self.set_bounds, 0, wxALIGN_LEFT|wxALL, 5 )
grid3 = wxFlexGridSizer( 0, 2, 5, 5 )
grid2.Add(grid3, 0, wxALIGN_LEFT )
grid2.Add( self.limit_check, 0, wxALIGN_LEFT|wxALL, 5 )
- grid2.Add( 20, 0, 0, wxALIGN_LEFT|wxALL, 5 )
+ grid2.Add( (20, 0), 0, wxALIGN_LEFT|wxALL, 5 )
- grid2.Add( 20, 0, 0, wxALIGN_LEFT|wxALL, 5 )
- grid2.Add( 20, 0, 0, wxALIGN_LEFT|wxALL, 5 )
+ grid2.Add( (20, 0), 0, wxALIGN_LEFT|wxALL, 5 )
+ grid2.Add( (20, 0), 0, wxALIGN_LEFT|wxALL, 5 )
grid2.Add( label, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5 )
grid2.Add( self.target_ctrl, 0, wxALIGN_LEFT|wxALL, 5 )
boundsbox.Add(grid2, 0, wxALIGN_CENTER|wxEXPAND|wxALL, 5)
vbox = wxBoxSizer( wxVERTICAL )
- vbox.AddSpacer(20, 20)
+ vbox.Add( (20, 20) )
vbox.Add( hbox, 0, wxALIGN_LEFT|wxALL, 5)
vbox.Add( boundsbox, 0, wxALIGN_LEFT|wxALL, 5 )
%addtofunc wxPyArtProvider "self._setCallbackInfo(self, ArtProvider)"
wxPyArtProvider();
- ~wxPyArtProvider();
+// ~wxPyArtProvider();
void _setCallbackInfo(PyObject* self, PyObject* _class);
virtual long GetInsertionPoint() const;
virtual long GetLastPosition() const;
virtual void Replace(long from, long to, const wxString& value);
+ void SetSelection(int n);
%name(SetMark) virtual void SetSelection(long from, long to);
virtual void SetEditable(bool editable);
raise ValueError('textlist and coords must have same length')
if foregrounds is None:
foregrounds = []
- elif isinstance(foregrounds, wxColour):
+ elif isinstance(foregrounds, wx.Colour):
foregrounds = [foregrounds]
elif len(foregrounds) != len(coords):
raise ValueError('foregrounds and coords must have same length')
if backgrounds is None:
backgrounds = []
- elif isinstance(backgrounds, wxColour):
+ elif isinstance(backgrounds, wx.Colour):
backgrounds = [backgrounds]
elif len(backgrounds) != len(coords):
raise ValueError('backgrounds and coords must have same length')
%name(DropTarget) class wxPyDropTarget // : public wxDropTarget
{
public:
- %addtofunc wxPyDropTarget "if args: args[1].thisown = 0; self._setCallbackInfo(self, DropTarget)"
+ %addtofunc wxPyDropTarget
+ "if args: args[0].thisown = 0;
+ self._setCallbackInfo(self, DropTarget)"
wxPyDropTarget(wxDataObject *dataObject = NULL);
void _setCallbackInfo(PyObject* self, PyObject* _class);
class wxPreviewCanvas: public wxScrolledWindow
{
public:
- %addtofunc wxPreviewCanvas "self._self._setOORInfo(self)"
+ %addtofunc wxPreviewCanvas "self._setOORInfo(self)"
wxPreviewCanvas(wxPrintPreview *preview,
wxWindow *parent,
class wxPreviewFrame : public wxFrame {
public:
- %addtofunc wxPreviewFrame "self._self._setOORInfo(self)"
+ %addtofunc wxPreviewFrame "self._setOORInfo(self)"
wxPreviewFrame(wxPrintPreview* preview, wxFrame* parent, const wxString& title,
const wxPoint& pos = wxDefaultPosition,
class wxPreviewControlBar: public wxPanel
{
public:
- %addtofunc wxPreviewControlBar "self._self._setOORInfo(self)"
+ %addtofunc wxPreviewControlBar "self._setOORInfo(self)"
wxPreviewControlBar(wxPrintPreview *preview,
long buttons,
%extend {
wxTipWindow(wxWindow *parent,
- const wxString* text,
+ const wxString& text,
wxCoord maxLength = 100,
wxRect* rectBound = NULL) {
- wxString tmp = *text;
- return new wxTipWindow(parent, tmp, maxLength, NULL, rectBound);
+ return new wxTipWindow(parent, text, maxLength, NULL, rectBound);
}
}
if y is None:
return win.ConvertDialogPointToPixels(point_or_x)
else:
- return win.ConvertDialogPointToPixels(wxPoint(point_or_x, y))
+ return win.ConvertDialogPointToPixels(wx.Point(point_or_x, y))
def DLG_SZE(win, size_width, height=None):
if height is None:
return win.ConvertDialogSizeToPixels(size_width)
else:
- return win.ConvertDialogSizeToPixels(wxSize(size_width, height))
+ return win.ConvertDialogSizeToPixels(wx.Size(size_width, height))
}
else {
obj = PySequence_GetItem(foregroundList, i);
}
- if (! wxPyConvertSwigPtr(obj, (void **) &color, wxT("wxColour_p"))) {
+ if (! wxPyConvertSwigPtr(obj, (void **) &color, wxT("wxColour"))) {
if (!isFastForeground)
Py_DECREF(obj);
goto err2;
"""Replace(long from, long to, wxString value)"""
return _controls.ComboBox_Replace(*args, **kwargs)
+ def SetSelection(*args, **kwargs):
+ """SetSelection(int n)"""
+ return _controls.ComboBox_SetSelection(*args, **kwargs)
+
def SetMark(*args, **kwargs):
"""SetMark(long from, long to)"""
return _controls.ComboBox_SetMark(*args, **kwargs)
}
+static PyObject *_wrap_ComboBox_SetSelection(PyObject *self, PyObject *args, PyObject *kwargs) {
+ PyObject *resultobj;
+ wxComboBox *arg1 = (wxComboBox *) 0 ;
+ int arg2 ;
+ PyObject * obj0 = 0 ;
+ char *kwnames[] = {
+ (char *) "self",(char *) "n", NULL
+ };
+
+ if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"Oi:ComboBox_SetSelection",kwnames,&obj0,&arg2)) goto fail;
+ if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_wxComboBox,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
+ {
+ PyThreadState* __tstate = wxPyBeginAllowThreads();
+ (arg1)->SetSelection(arg2);
+
+ wxPyEndAllowThreads(__tstate);
+ if (PyErr_Occurred()) SWIG_fail;
+ }
+ Py_INCREF(Py_None); resultobj = Py_None;
+ return resultobj;
+ fail:
+ return NULL;
+}
+
+
static PyObject *_wrap_ComboBox_SetMark(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject *resultobj;
wxComboBox *arg1 = (wxComboBox *) 0 ;
{ (char *)"ComboBox_GetInsertionPoint", (PyCFunction) _wrap_ComboBox_GetInsertionPoint, METH_VARARGS | METH_KEYWORDS },
{ (char *)"ComboBox_GetLastPosition", (PyCFunction) _wrap_ComboBox_GetLastPosition, METH_VARARGS | METH_KEYWORDS },
{ (char *)"ComboBox_Replace", (PyCFunction) _wrap_ComboBox_Replace, METH_VARARGS | METH_KEYWORDS },
+ { (char *)"ComboBox_SetSelection", (PyCFunction) _wrap_ComboBox_SetSelection, METH_VARARGS | METH_KEYWORDS },
{ (char *)"ComboBox_SetMark", (PyCFunction) _wrap_ComboBox_SetMark, METH_VARARGS | METH_KEYWORDS },
{ (char *)"ComboBox_SetEditable", (PyCFunction) _wrap_ComboBox_SetEditable, METH_VARARGS | METH_KEYWORDS },
{ (char *)"ComboBox_SetInsertionPointEnd", (PyCFunction) _wrap_ComboBox_SetInsertionPointEnd, METH_VARARGS | METH_KEYWORDS },
if y is None:
return win.ConvertDialogPointToPixels(point_or_x)
else:
- return win.ConvertDialogPointToPixels(wxPoint(point_or_x, y))
+ return win.ConvertDialogPointToPixels(wx.Point(point_or_x, y))
def DLG_SZE(win, size_width, height=None):
if height is None:
return win.ConvertDialogSizeToPixels(size_width)
else:
- return win.ConvertDialogSizeToPixels(wxSize(size_width, height))
+ return win.ConvertDialogSizeToPixels(wx.Size(size_width, height))
def FindWindowById(*args, **kwargs):
raise ValueError('textlist and coords must have same length')
if foregrounds is None:
foregrounds = []
- elif isinstance(foregrounds, wxColour):
+ elif isinstance(foregrounds, wx.Colour):
foregrounds = [foregrounds]
elif len(foregrounds) != len(coords):
raise ValueError('foregrounds and coords must have same length')
if backgrounds is None:
backgrounds = []
- elif isinstance(backgrounds, wxColour):
+ elif isinstance(backgrounds, wx.Colour):
backgrounds = [backgrounds]
elif len(backgrounds) != len(coords):
raise ValueError('backgrounds and coords must have same length')
// First, make a new instance of the tag handler
wxPyBeginBlockThreads();
- PyObject* arg = Py_BuildValue("()");
- PyObject* obj = PyInstance_New(m_tagHandlerClass, arg, NULL);
+ PyObject* arg = PyTuple_New(0);
+ PyObject* obj = PyObject_CallObject(m_tagHandlerClass, arg);
Py_DECREF(arg);
- wxPyEndBlockThreads();
-
+
// now figure out where it's C++ object is...
wxPyHtmlWinTagHandler* thPtr;
- if (! wxPyConvertSwigPtr(obj, (void **)&thPtr, wxT("wxPyHtmlWinTagHandler")))
+ if (! wxPyConvertSwigPtr(obj, (void **)&thPtr, wxT("wxPyHtmlWinTagHandler"))) {
+ wxPyEndBlockThreads();
return;
+ }
+ wxPyEndBlockThreads();
// add it,
parser->AddTagHandler(thPtr);
del newobj.thisown
self._setCallbackInfo(self, ArtProvider)
- def __del__(self, destroy=_misc.delete_ArtProvider):
- """__del__()"""
- try:
- if self.thisown: destroy(self)
- except: pass
-
def _setCallbackInfo(*args, **kwargs):
"""_setCallbackInfo(PyObject self, PyObject _class)"""
return _misc.ArtProvider__setCallbackInfo(*args, **kwargs)
self.this = newobj.this
self.thisown = 1
del newobj.thisown
- if args: args[1].thisown = 0; self._setCallbackInfo(self, DropTarget)
+ if args: args[0].thisown = 0;
+ self._setCallbackInfo(self, DropTarget)
def _setCallbackInfo(*args, **kwargs):
"""_setCallbackInfo(PyObject self, PyObject _class)"""
}
-static PyObject *_wrap_delete_ArtProvider(PyObject *self, PyObject *args, PyObject *kwargs) {
- PyObject *resultobj;
- wxPyArtProvider *arg1 = (wxPyArtProvider *) 0 ;
- PyObject * obj0 = 0 ;
- char *kwnames[] = {
- (char *) "self", NULL
- };
-
- if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O:delete_ArtProvider",kwnames,&obj0)) goto fail;
- if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_wxPyArtProvider,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
- {
- PyThreadState* __tstate = wxPyBeginAllowThreads();
- delete arg1;
-
- wxPyEndAllowThreads(__tstate);
- if (PyErr_Occurred()) SWIG_fail;
- }
- Py_INCREF(Py_None); resultobj = Py_None;
- return resultobj;
- fail:
- return NULL;
-}
-
-
static PyObject *_wrap_ArtProvider__setCallbackInfo(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject *resultobj;
wxPyArtProvider *arg1 = (wxPyArtProvider *) 0 ;
{ (char *)"delete_MimeTypesManager", (PyCFunction) _wrap_delete_MimeTypesManager, METH_VARARGS | METH_KEYWORDS },
{ (char *)"MimeTypesManager_swigregister", MimeTypesManager_swigregister, METH_VARARGS },
{ (char *)"new_ArtProvider", (PyCFunction) _wrap_new_ArtProvider, METH_VARARGS | METH_KEYWORDS },
- { (char *)"delete_ArtProvider", (PyCFunction) _wrap_delete_ArtProvider, METH_VARARGS | METH_KEYWORDS },
{ (char *)"ArtProvider__setCallbackInfo", (PyCFunction) _wrap_ArtProvider__setCallbackInfo, METH_VARARGS | METH_KEYWORDS },
{ (char *)"ArtProvider_PushProvider", (PyCFunction) _wrap_ArtProvider_PushProvider, METH_VARARGS | METH_KEYWORDS },
{ (char *)"ArtProvider_PopProvider", (PyCFunction) _wrap_ArtProvider_PopProvider, METH_VARARGS | METH_KEYWORDS },
self.this = newobj.this
self.thisown = 1
del newobj.thisown
- self._self._setOORInfo(self)
+ self._setOORInfo(self)
class PreviewCanvasPtr(PreviewCanvas):
self.this = newobj.this
self.thisown = 1
del newobj.thisown
- self._self._setOORInfo(self)
+ self._setOORInfo(self)
def Initialize(*args, **kwargs):
"""Initialize()"""
self.this = newobj.this
self.thisown = 1
del newobj.thisown
- self._self._setOORInfo(self)
+ self._setOORInfo(self)
def GetZoomControl(*args, **kwargs):
"""GetZoomControl() -> int"""
#include <wx/tipwin.h>
-wxTipWindow *new_wxTipWindow(wxWindow *parent,wxString const *text,int maxLength,wxRect *rectBound){
- wxString tmp = *text;
- return new wxTipWindow(parent, tmp, maxLength, NULL, rectBound);
+wxTipWindow *new_wxTipWindow(wxWindow *parent,wxString const &text,int maxLength,wxRect *rectBound){
+ return new wxTipWindow(parent, text, maxLength, NULL, rectBound);
}
#include <wx/tipwin.h>
static PyObject *_wrap_new_TipWindow(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject *resultobj;
wxWindow *arg1 = (wxWindow *) 0 ;
- wxString *arg2 = (wxString *) 0 ;
+ wxString *arg2 = 0 ;
int arg3 = (int) 100 ;
wxRect *arg4 = (wxRect *) NULL ;
wxTipWindow *result;
+ bool temp2 = False ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
PyObject * obj3 = 0 ;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO|iO:new_TipWindow",kwnames,&obj0,&obj1,&arg3,&obj3)) goto fail;
if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_wxWindow,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
- if ((SWIG_ConvertPtr(obj1,(void **) &arg2, SWIGTYPE_p_wxString,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
+ {
+ arg2 = wxString_in_helper(obj1);
+ if (arg2 == NULL) SWIG_fail;
+ temp2 = True;
+ }
if (obj3) {
if ((SWIG_ConvertPtr(obj3,(void **) &arg4, SWIGTYPE_p_wxRect,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
}
{
PyThreadState* __tstate = wxPyBeginAllowThreads();
- result = (wxTipWindow *)new_wxTipWindow(arg1,(wxString const *)arg2,arg3,arg4);
+ result = (wxTipWindow *)new_wxTipWindow(arg1,(wxString const &)*arg2,arg3,arg4);
wxPyEndAllowThreads(__tstate);
if (PyErr_Occurred()) SWIG_fail;
}
resultobj = SWIG_NewPointerObj((void *) result, SWIGTYPE_p_wxTipWindow, 1);
+ {
+ if (temp2)
+ delete arg2;
+ }
return resultobj;
fail:
+ {
+ if (temp2)
+ delete arg2;
+ }
return NULL;
}
self.setConstraintSides(self.left, wxLeft, left,
self.right, wxRight, right,
self.width, wxWidth, self.centreX,
- cPos.x, cSize.x, pSize.x, parent)
+ cPos.x, cSize.width, pSize.width, parent)
self.setConstraintSides(self.top, wxTop, top,
self.bottom, wxBottom, bottom,
self.height, wxHeight, self.centreY,
- cPos.y, cSize.y, pSize.y, parent)
+ cPos.y, cSize.height, pSize.height, parent)
def setConstraintSides(self, side1, side1Edge, side1Anchor,
side2, side2Edge, side2Anchor,
if self.outer_border is True:
rect = wxRect(self.cx_st, self.cy_st, self.sizew, self.sizeh) # full display window area
- self.DC.DrawRectangle(rect.x, rect.y, rect.width, rect.height)
+ self.DC.DrawRectangleRect(rect)
def DrawNumVal(self):
self.DrawNum()
tw,th = self.DC.GetTextExtent(month)
adjust = self.cx_st + (self.sizew-tw)/2
- self.DC.DrawText(month, adjust, self.cy_st + th)
+ self.DC.DrawText(month, (adjust, self.cy_st + th))
year = str(self.year)
tw,th = self.DC.GetTextExtent(year)
f = wxFont(sizef, self.font, wxNORMAL, self.bold)
self.DC.SetFont(f)
- self.DC.DrawText(year, self.cx_st + adjust, self.cy_st + th)
+ self.DC.DrawText(year, (self.cx_st + adjust, self.cy_st + th))
def DrawWeek(self): # draw the week days
width = self.gridx[1]-self.gridx[0]
brush = wxBrush(wxNamedColour(self.week_color), wxSOLID)
self.DC.SetBrush(brush)
-# self.DC.DrawRectangle(self.gridx[0], self.gridy[0], rect_w+1, height)
+# self.DC.DrawRectangle((self.gridx[0], self.gridy[0]), (rect_w+1, height))
if self.cal_type == "NORMAL":
cal_days = CalDays
x = self.gridx[cnt_x]
y = self.gridy[cnt_y]
- self.DC.DrawRectangle(self.gridx[cnt_x], self.gridy[0], width+1, height)
- self.DC.DrawText(day, x+diffx, y+diffy)
+ self.DC.DrawRectangle((self.gridx[cnt_x], self.gridy[0]), (width+1, height))
+ self.DC.DrawText(day, (x+diffx, y+diffy))
cnt_x = cnt_x + 1
def DrawNum(self): # draw the day numbers
adj_v = adj_v + self.num_indent_vert
- self.DC.DrawText(val, x+adj_h, y+adj_v)
+ self.DC.DrawText(val, (x+adj_h, y+adj_v))
if cnt_x < 6:
cnt_x = cnt_x + 1
else:
self.DC.SetPen(wxPen(wxNamedColour(self.back_color), 0))
nkey = key + self.st_pos -1
rect = self.rg[nkey]
- self.DC.DrawRectangle(rect.x, rect.y, rect.width+1, rect.height+1)
+ self.DC.DrawRectangle((rect.x, rect.y), (rect.width+1, rect.height+1))
def DrawGrid(self): # calculate and draw the grid lines
self.DC.SetPen(wxPen(wxNamedColour(self.grid_color), 0))
y2 = y1 + self.cheight
for i in range(8):
if self.hide_grid is False:
- self.DC.DrawLine(x1, y1, x1, y2)
+ self.DC.DrawLine((x1, y1), (x1, y2))
self.gridx.append(x1)
x1 = x1 + self.dl_w
x2 = x1 + self.cwidth
for i in range(8):
if self.hide_grid is False:
- self.DC.DrawLine(x1, y1, x2, y1)
+ self.DC.DrawLine((x1, y1), (x2, y1))
self.gridy.append(y1)
if i == 0:
y1 = y1 + self.dl_th
self.select_list = []
- self.SetBackgroundColour(wxNamedColor(self.back_color))
+ self.SetBackgroundColour(wxNamedColour(self.back_color))
self.Connect(-1, -1, wxEVT_LEFT_DOWN, self.OnLeftEvent)
self.Connect(-1, -1, wxEVT_LEFT_DCLICK, self.OnLeftDEvent)
self.Connect(-1, -1, wxEVT_RIGHT_DOWN, self.OnRightEvent)
DC.SetPen(wxPen(wxNamedColour(color), width))
rect = self.rg[key]
- DC.DrawRectangle(rect.x, rect.y, rect.width+1, rect.height+1)
+ DC.DrawRectangle((rect.x, rect.y), (rect.width+1, rect.height+1))
DC.EndDrawing()
class CalenDlg(wxDialog):
def __init__(self, parent, month=None, day = None, year=None):
- wxDialog.__init__(self, parent, -1, "Event Calendar", wxPyDefaultPosition, wxSize(280, 360))
+ wxDialog.__init__(self, parent, -1, "Event Calendar", wxDefaultPosition, wxSize(280, 360))
# set the calendar and attributes
self.calend = wxCalendar(self, -1, wxPoint(20, 60), wxSize(240, 200))
win = FakeWindow()
try:
eventMacro(win, None, None)
- except TypeError:
+ except (TypeError, AssertionError):
eventMacro(win, None)
self.lookupTable[eventMacro] = win.eventTypes
return win.eventTypes
try:
func(win, id, self.handleEvent)
self.callStyle = 3
- except TypeError:
+ except (TypeError, AssertionError):
func(win, self.handleEvent)
self.callStyle = 2
assert row != -1, "Row must be specified"
assert col != -1, "Column must be specified"
- wxPySizer.AddSpacer(self, width, height, option, flag, border,
+ wxPySizer.AddSpacer(self, (width, height), option, flag, border,
userData=(row, col, row+rowspan, col+colspan))
#--------------------------------------------------
import wx
# ------------------------------------------------------------------------------
+
THROBBER_EVENT = wx.NewEventType()
def EVT_UPDATE_THROBBER(win, func):
win.Connect(-1, -1, THROBBER_EVENT, func)
def Draw(self, dc):
- dc.DrawBitmap(self.submaps[self.sequence[self.current]], 0, 0, True)
+ dc.DrawBitmap(self.submaps[self.sequence[self.current]], (0, 0), True)
if self.overlay and self.showOverlay:
- dc.DrawBitmap(self.overlay, self.overlayX, self.overlayY, True)
+ dc.DrawBitmap(self.overlay, (self.overlayX, self.overlayY), True)
if self.label and self.showLabel:
- dc.DrawText(self.label, self.labelX, self.labelY)
+ dc.DrawText(self.label, (self.labelX, self.labelY))
dc.SetTextForeground(wx.WHITE)
- dc.DrawText(self.label, self.labelX-1, self.labelY-1)
+ dc.DrawText(self.label, (self.labelX-1, self.labelY-1))
def OnPaint(self, event):
"""Start the animation"""
if not self.running:
self.running = not self.running
- self.timer.Start(self.frameDelay * 1000)
+ self.timer.Start(int(self.frameDelay * 1000))
def Stop(self):
</body></html>
"""
-import string, copy
+import string, copy, types
from wxPython.wx import *
from wxPython.tools.dbg import Logger
from wxPython.lib.maskededit import wxMaskedTextCtrl, Field
__doc__ = wx.lib.calendar.__doc__
+Date = wx.lib.calendar.Date
+FillDate = wx.lib.calendar.FillDate
+FormatDay = wx.lib.calendar.FormatDay
+FromJulian = wx.lib.calendar.FromJulian
+TodayDay = wx.lib.calendar.TodayDay
+dayOfWeek = wx.lib.calendar.dayOfWeek
+daysPerMonth = wx.lib.calendar.daysPerMonth
+isleap = wx.lib.calendar.isleap
+julianDay = wx.lib.calendar.julianDay
+leapdays = wx.lib.calendar.leapdays
+now = wx.lib.calendar.now
+Month = wx.lib.calendar.Month
+mdays = wx.lib.calendar.mdays
+day_name = wx.lib.calendar.day_name
+day_abbr = wx.lib.calendar.day_abbr
+
+
CalDraw = wx.lib.calendar.CalDraw
CalenDlg = wx.lib.calendar.CalenDlg
GetMonthList = wx.lib.calendar.GetMonthList
PrtCalDraw = wx.lib.calendar.PrtCalDraw
wxCalendar = wx.lib.calendar.wxCalendar
+
EventManager = wx.lib.evtmgr.EventManager
FakeWindow = wx.lib.evtmgr.FakeWindow
MessageAdapter = wx.lib.evtmgr.MessageAdapter
+eventManager = wx.lib.evtmgr.eventManager