rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
self.y_spin = wx.SpinButton(self, -1, (220, 20), (h*2, h), wx.SP_VERTICAL)
self.y_spin = wx.SpinButton(self, -1, (225, 20), (h*1.5, h), wx.SP_VERTICAL)
def __init__(self, parent, month=None, day = None, year=None): wx.Dialog.__init__(self, parent, -1, "Event Calendar", wx.DefaultPosition, (280, 360))
btn = wx.Button(self, -1, ' Ok ', (x_pos, y_pos), but_size)
btn = wx.Button(self, wx.ID_OK, ' Ok ', (x_pos, y_pos), but_size)
def __init__(self, parent, month=None, day = None, year=None): wx.Dialog.__init__(self, parent, -1, "Event Calendar", wx.DefaultPosition, (280, 360))
btn = wx.Button(self, -1, ' Close ', (x_pos + 120, y_pos), but_size)
btn = wx.Button(self, wx.ID_CANCEL, ' Close ', (x_pos + 120, y_pos), but_size)
def __init__(self, parent, month=None, day = None, year=None): wx.Dialog.__init__(self, parent, -1, "Event Calendar", wx.DefaultPosition, (280, 360))
def OnOk(self, event):
def OnOk(self, evt): self.result = ['None', str(self.calend.day), Month[self.calend.month], str(self.calend.year)]
def OnOk(self, event): self.EndModal(wx.ID_OK)
cmd = ['swig'] + swig_args + ['-I'+dir, '-c', '-o', cpp_file, i_file]
cmd = ['./wxSWIG/wxswig'] + swig_args + ['-I'+dir, '-c', '-o', cpp_file, i_file]
def run_swig(files, dir, gendir, package, USE_SWIG, force, swig_args, swig_deps=[]): from distutils.file_util import copy_file from distutils.dep_util import newer from distutils.spawn import spawn sources = [] for file in files: basefile = os.path.splitext(file)[0] i_file = os.path.join(dir, file) py_file = os.pa...
wxScrolledWindow.Refresh(self)
wxScrolledWindow.Refresh(self, false)
def Refresh(self): if self.doubleBuffered: self.painter.ClearBuffer() wxScrolledWindow.Refresh(self)
self.text = wxTextCtrl(self.frame, -1, "", style = wx.TE_MULTILINE | wx.TE_READONLY)
self.text = wx.TextCtrl(self.frame, -1, "", style = wx.TE_MULTILINE | wx.TE_READONLY)
def CreateOutputWindow(self, st): self.frame = wx.Frame(self.parent, -1, self.title, style=wx.DEFAULT_FRAME_STYLE | wx.NO_FULL_REPAINT_ON_RESIZE) self.text = wxTextCtrl(self.frame, -1, "", style = wx.TE_MULTILINE | wx.TE_READONLY) self.frame.SetSize((450, 300)) self.frame.Show(True) EVT_CLOSE(self.frame, self.OnCloseW...
self.frame = wxFrame(None, -1, "Widget Tester", pos=(0,0), size=self.size)
self.frame = wx.Frame(None, -1, "Widget Tester", pos=(0,0), size=self.size)
def OnInit(self): self.frame = wxFrame(None, -1, "Widget Tester", pos=(0,0), size=self.size) self.SetTopWindow(self.frame) return True
def __str__(self): return str(self.asTuple()) def __repr__(self): return str(self.asTuple())
def __str__(self): return str(self.asTuple()) def __repr__(self): return str(self.asTuple()) def __len__(self): return len(self.asTuple()) def __getitem__(self, index): return self.asTuple()[index] def __setitem__(self, index, val): if index == 0: self.width =...
def __str__(self): return str(self.asTuple())
def __str__(self): return str(self.asTuple()) def __repr__(self): return str(self.asTuple())
def __str__(self): return str(self.asTuple()) def __repr__(self): return str(self.asTuple()) def __len__(self): return len(self.asTuple()) def __getitem__(self, index): return self.asTuple()[index] def __setitem__(self, index, val): if index == 0: self.x = val...
def __str__(self): return str(self.asTuple())
def __str__(self): return str(self.asTuple()) def __repr__(self): return str(self.asTuple())
def __str__(self): return str(self.asTuple())
def __del__(self,oglshapesc=oglshapesc): if self.thisown == 1 : oglshapesc.delete_wxOGLConstraint(self)
def __del__(self,oglshapesc=oglshapesc): if self.thisown == 1 : oglshapesc.delete_wxOGLConstraint(self)
'six', 'seven', 'eight'], wxOK|wxCANCEL)
'six', 'seven', 'eight'], wxDEFAULT_DIALOG_STYLE|wxOK|wxCANCEL)
def runTest(frame, nb, log): dlg = wxSingleChoiceDialog(frame, 'Test Single Choice', 'The Caption', ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight'], wxOK|wxCANCEL) if dlg.ShowModal() == wxID_OK: log.WriteText('You selected: %s\n' % dlg.GetStringSelection()) dlg.Destroy()
self.shiftkey = event.ShiftDown() self.ctrlkey = event.ControlDown()
def OnLeftEvent(self, event): self.click = 'LEFT' self.shiftkey = event.ShiftDown() self.ctrlkey = event.ControlDown() self.ProcessClick(event)
b = wx.Button(self, -1, "Show the FloatBar sample", (50,50))
b = wx.Button(self, -1, "Show the FloatCanvas sample", (50,50))
def __init__(self, parent, log): self.log = log wx.Panel.__init__(self, parent, -1)
self.html.SetPage(About.MyAboutBox.text % (wx.VERSION_STRING, py_version))
self.html.SetPage(About.MyAboutBox.text % (wx.VERSION_STRING, ", ".join(wx.PlatformInfo[1:]), py_version))
def __init__(self, parent, id=-1, size=wx.DefaultSize):
libdirs = [opj(WXDIR, 'lib'), 'build\\ilib']
libdirs = [ opj(WXDIR, 'lib') ]
def libFlag(): if FINAL: rv = '' elif HYBRID: rv = 'h' else: rv = 'd' if UNICODE: rv = 'u' + rv return rv
cflags = [
cflags = [ '/Gy',
def libFlag(): if FINAL: rv = '' elif HYBRID: rv = 'h' else: rv = 'd' if UNICODE: rv = 'u' + rv return rv
if not FINAL and HYBRID and not bcpp_compiling: cflags = cflags + ['/Od', '/Z7'] lflags = ['/DEBUG', ] elif bcpp_compiling and not FINAL: cflags = cflags + ['/Od', '/v', '/y'] lflags = lflags + ['/v', ]
if not FINAL: cflags = cflags + ['/Od', '/v', '/y'] lflags = lflags + ['/v', ] else: if FINAL: pass elif HYBRID : pass else: pass
def libFlag(): if FINAL: rv = '' elif HYBRID: rv = 'h' else: rv = 'd' if UNICODE: rv = 'u' + rv return rv
self.SetValue(calltip)
self.Clear() self.AppendText(calltip)
def display(self, calltip): """Receiver for Shell.calltip signal.""" self.SetValue(calltip)
self._pen = wx.Pen(wx.BLACK, 1, wx.SOLID)
self._pen = BlackForegroundPen
def __init__(self, canvas = None): ShapeEvtHandler.__init__(self) self._eventHandler = self self.SetShape(self) self._id = 0 self._formatted = False self._canvas = canvas self._xpos = 0.0 self._ypos = 0.0 self._pen = wx.Pen(wx.BLACK, 1, wx.SOLID) self._brush = wx.WHITE_BRUSH self._font = wx.Font(10, wx.SWISS, wx.NORMA...
self._font = wx.Font(10, wx.SWISS, wx.NORMAL, wx.NORMAL)
self._font = NormalFont
def __init__(self, canvas = None): ShapeEvtHandler.__init__(self) self._eventHandler = self self.SetShape(self) self._id = 0 self._formatted = False self._canvas = canvas self._xpos = 0.0 self._ypos = 0.0 self._pen = wx.Pen(wx.BLACK, 1, wx.SOLID) self._brush = wx.WHITE_BRUSH self._font = wx.Font(10, wx.SWISS, wx.NORMA...
region.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, wx.NORMAL))
region.SetFont(NormalFont)
def __init__(self, canvas = None): ShapeEvtHandler.__init__(self) self._eventHandler = self self.SetShape(self) self._id = 0 self._formatted = False self._canvas = canvas self._xpos = 0.0 self._ypos = 0.0 self._pen = wx.Pen(wx.BLACK, 1, wx.SOLID) self._brush = wx.WHITE_BRUSH self._font = wx.Font(10, wx.SWISS, wx.NORMA...
if '-D__WXDEBUG__' in cflags: gl_libs = ['wx_gtkd_gl', 'GL', 'GLU'] else: gl_libs = ['wx_gtk_gl', 'GL', 'GLU']
gl_libs = os.popen(WX_CONFIG + ' --gl-libs', 'r').read()[:-1] gl_libs = string.split(gl_libs)
def opj(*args): path = apply(os.path.join, args) return os.path.normpath(path)
libraries = libs + gl_libs, extra_compile_args = cflags, extra_link_args = lflags,
libraries = libs, extra_compile_args = cflags, extra_link_args = gl_libs + lflags,
def opj(*args): path = apply(os.path.join, args) return os.path.normpath(path)
self.resizeCloumn(self, minWidth)
self.resizeColumn(self, minWidth)
def resizeLastColumn(self, minWidth): """ Resize the last column appropriately.
new_vs_x = cpos.x / sppu_x
new_vs_x = vs_x + (cpos.x / sppu_x)
def OnChildFocus(self, evt): # If the child window that gets the focus is not visible, # this handler will try to scroll enough to see it. evt.Skip() child = evt.GetWindow()
new_vs_y = cpos.y / sppu_y
new_vs_y = vs_y + (cpos.y / sppu_y)
def OnChildFocus(self, evt): # If the child window that gets the focus is not visible, # this handler will try to scroll enough to see it. evt.Skip() child = evt.GetWindow()
self.SetBackgroundColour(self._bc)
if wx.Platform != "__WXMAC__": self.SetBackgroundColour(self._bc)
def createDialog( self, parent, id, pos, size, style ): """Setup the graphic representation of the dialog""" wx.Panel.__init__ (self, parent, id, pos, size, style) self.SetMinSize(size) # play nice with sizers
self.EnsureVisible(line)
self.GotoLine(line)
def ShowPosition(self, pos): line = self.LineFromPosition(pos) self.EnsureVisible(line)
self.SetViewEOL(False)
self.SetEOLMode(wx.stc.STC_EOL_LF) self.SetViewEOL(False)
def SetUpEditor(self): """ This method carries out the work of setting up the demo editor. It's seperate so as not to clutter up the init code. """ import keyword self.SetLexer(stc.STC_LEX_PYTHON) self.SetKeyWords(0, " ".join(keyword.kwlist))
f = open(modifiedFilename, "w")
f = open(modifiedFilename, "wt")
def OnSave(self, event): if self.demoModules.Exists(modModified): if self.demoModules.GetActiveID() == modOriginal: overwriteMsg = "You are about to overwrite an already existing modified copy\n" + \ "Do you want to continue?" dlg = wx.MessageDialog(self, overwriteMsg, "wxPython Demo", wx.YES_NO | wx.NO_DEFAULT| wx.ICO...
file = open(filename, "r")
file = open(filename, "rt")
def LoadFromFile(self, modID, filename): self.modules[modID][2] = filename file = open(filename, "r") self.LoadFromSource(modID, file.read()) file.close()
file = open(filename, "w")
file = open(filename, "wt")
def UpdateFile(self, modID = None): """Updates the file from which a module was loaded with (possibly updated) source""" if modID is None: modID = self.modActive
helpID = wx.NewId() findID = wx.NewId() findnextID = wx.NewId()
def EmptyHandler(evt): pass
prevSelect = self.UpdateNotebook()
def RunModule(self): """Runs the active module"""
self.UpdateNotebook()
self.UpdateNotebook(prevSelect)
def RunModule(self): """Runs the active module"""
if select >= 0:
if select >= 0 and select < nb.GetPageCount():
def UpdatePage(page, pageText): pageExists = False pagePos = -1 for i in range(nb.GetPageCount()): if nb.GetPageText(i) == pageText: pageExists = True pagePos = i break if page: if not pageExists: # Add a new page
dc.SetPen(wx.Pen(wx.NamedColour(colour), int(width), style))
pen = wx.Pen(wx.NamedColour(colour), width, style) pen.SetCap(wx.CAP_BUTT) dc.SetPen(pen)
def draw(self, dc, printerScale, coord= None): colour = self.attributes['colour'] width = self.attributes['width'] * printerScale style= self.attributes['style'] dc.SetPen(wx.Pen(wx.NamedColour(colour), int(width), style)) if coord == None: dc.DrawLines(self.scaled) else: dc.DrawLines(coord) # draw legend line
dc.SetPen(wx.Pen(wx.NamedColour(colour),int(width)))
dc.SetPen(wx.Pen(wx.NamedColour(colour), width))
def draw(self, dc, printerScale, coord= None): colour = self.attributes['colour'] width = self.attributes['width'] * printerScale size = self.attributes['size'] * printerScale fillcolour = self.attributes['fillcolour'] fillstyle = self.attributes['fillstyle'] marker = self.attributes['marker']
dc = FloatDCWrapper(wx.BufferedDC(wx.ClientDC(self), self._Buffer))
dc = wx.BufferedDC(wx.ClientDC(self), self._Buffer)
def Draw(self, graphics, xAxis = None, yAxis = None, dc = None): """Draw objects in graphics with specified x and y axis. graphics- instance of PlotGraphics with list of PolyXXX objects xAxis - tuple with (min, max) axis range to view yAxis - same as xAxis dc - drawing context - doesn't have to be specified. If it's no...
return int(ptx),int(pty),int(rectWidth),int(rectHeight)
return ptx, pty, rectWidth, rectHeight
def _point2ClientCoord(self, corner1, corner2): """Converts user point coords to client screen int coords x,y,width,height""" c1= Numeric.array(corner1) c2= Numeric.array(corner2) # convert to screen coords pt1= c1*self._pointScale+self._pointShift pt2= c2*self._pointScale+self._pointShift # make height and width posit...
dc.SetPen(wx.Pen(wx.NamedColour('BLACK'),int(penWidth)))
dc.SetPen(wx.Pen(wx.NamedColour('BLACK'), penWidth))
def _drawAxes(self, dc, p1, p2, scale, shift, xticks, yticks): penWidth= self.printerScale # increases thickness for printing only dc.SetPen(wx.Pen(wx.NamedColour('BLACK'),int(penWidth))) # set length of tick marks--long ones make grid if self._gridEnabled: x,y,width,height= self._point2ClientCoord(p1,p2) yTic...
dc = FloatDCWrapper(self.GetDC())
dc = self.GetDC()
def OnPrintPage(self, page): dc = FloatDCWrapper(self.GetDC()) # allows using floats for certain functions
class FloatDCWrapper: def __init__(self, aDC): self.theDC = aDC def DrawLine(self, x1,y1,x2,y2): self.theDC.DrawLine(int(x1),int(y1), int(x2),int(y2)) def DrawText(self, txt, x, y): self.theDC.DrawText(txt, int(x), int(y)) def DrawRotatedText(self, txt, x, y, angle): self.theDC.DrawRotatedText(txt, int(x), int(y), a...
def OnPrintPage(self, page): dc = FloatDCWrapper(self.GetDC()) # allows using floats for certain functions
elif pt._type == CONTROL_POINT_DIAGONAL and (keys & KEYS or self.GetMaintainAspectRatio()):
elif pt._type == CONTROL_POINT_DIAGONAL and (keys & KEY_SHIFT or self.GetMaintainAspectRatio()):
def OnSizingBeginDragLeft(self, pt, x, y, keys = 0, attachment = 0): self._canvas.CaptureMouse()
self.rowHeights = [] self.colWidths = []
def CalcMin( self ): items = self.GetChildren() if not items: return wxSize(10, 10)
return (0, 1, 1, 1)
return (1, 1, 1, 1)
def GetPageInfo(self): return (0, 1, 1, 1) # disable page numbers
ext = ft.GetExtensions()[0] if ext[0] == ".": ext = ext[1:]
extList = ft.GetExtensions() if extList: ext = extList[0] if ext[0] == ".": ext = ext[1:] else: ext = ""
def Update(self, ft): #icon = ft.GetIcon() info = ft.GetIconInfo() if info is None: bmp = MyBitmapsFunc(0) ##print bmp.Ok(), bmp.GetWidth(), bmp.GetHeight() self.GetIconBmp().SetBitmap(bmp) self.GetIconFileTxt().SetValue("") self.GetIconIndexTxt().SetValue("") else: icon, file, idx = info #bmp = wxBitmapFromIcon(icon) ...
wx.wxButton(dlg, wx.ID_OK, "Find Next", (280, 5), wx.DefaultSize).SetDefault() wx.wxButton(dlg, wx.ID_CANCEL, "Cancel", (280, 35), wx.DefaultSize)
wx.Button(dlg, wx.ID_OK, "Find Next", (280, 5), wx.DefaultSize).SetDefault() wx.Button(dlg, wx.ID_CANCEL, "Cancel", (280, 35), wx.DefaultSize)
def findDialog(parent=None, searchText='', wholeWordsOnly=0, caseSensitive=0): dlg = wx.Dialog(parent, -1, "Find", wx.DefaultPosition, (370, 120)) wx.StaticText(dlg, -1, 'Find what:', (7, 10)) wSearchText = wx.TextCtrl(dlg, -1, searchText, (70, 7), (195, -1)) wSearchText.SetValue(searchText) wx.wxButton(dlg, wx.ID_OK,...
frame = wx.Frame(None, -1, "Dialogs", size=(400, 200))
self.frame = frame = wx.Frame(None, -1, "Dialogs", size=(400, 200))
def OnInit(self): frame = wx.Frame(None, -1, "Dialogs", size=(400, 200)) panel = wx.Panel(frame, -1) self.panel = panel
frame.Show(1)
def OnInit(self): frame = wx.Frame(None, -1, "Dialogs", size=(400, 200)) panel = wx.Panel(frame, -1) self.panel = panel
self.nameList = wx.ListBox(panel, -1, (0, 0), (130, 180), dialogNames, style=wx.LB_SINGLE) self.Bind(wx.EVT_LISTBOX, self.OnNameListSelected, id=self.nameList.GetId())
self.nameList = wx.ListBox(panel, -1, size=(130, 180), choices=dialogNames, style=wx.LB_SINGLE) self.Bind(wx.EVT_LISTBOX, self.OnNameListSelected, self.nameList)
def OnInit(self): frame = wx.Frame(None, -1, "Dialogs", size=(400, 200)) panel = wx.Panel(frame, -1) self.panel = panel
self.text1 = wx.TextCtrl(panel, -1, pos=(150, 0), size=(200, 180), style=tstyle)
self.text1 = wx.TextCtrl(panel, -1, size=(200, 180), style=tstyle) sizer = wx.BoxSizer(wx.HORIZONTAL) sizer.Add(self.nameList, 0, wx.EXPAND|wx.ALL, 20) sizer.Add(self.text1, 1, wx.EXPAND|wx.ALL, 20) panel.SetSizer(sizer)
def OnInit(self): frame = wx.Frame(None, -1, "Dialogs", size=(400, 200)) panel = wx.Panel(frame, -1) self.panel = panel
frame.Show(1)
def OnInit(self): frame = wx.Frame(None, -1, "Dialogs", size=(400, 200)) panel = wx.Panel(frame, -1) self.panel = panel
'A Message Box', wx.wxOK | wx.wxICON_INFORMATION)
'A Message Box', wx.OK | wx.ICON_INFORMATION)
def OnNameListSelected(self, evt): import pprint sel = evt.GetString() result = None if sel == 'alertDialog': result = alertDialog(message='Danger Will Robinson') elif sel == 'colorDialog': result = colorDialog() elif sel == 'directoryDialog': result = directoryDialog() elif sel == 'fileDialog': wildcard = "JPG files (...
def CreateView(self, document, flags=0):
def CreateView(self, doc, flags=0):
def CreateView(self, document, flags=0): """ Creates a new view for the given document. If more than one view is allowed for the document (by virtue of multiple templates mentioning the same document type), a choice of view is presented to the user. """ templates = [] for temp in self._templates: if temp.IsVisible(): i...
if os.path.exists("splash.png"): self.ShowSplash("splash.png")
if os.path.exists(TextEditorApplication.SPLASH): self.ShowSplash(TextEditorApplication.SPLASH)
def OnInit(self): # Call the super - this is important!!! pydocview.DocApp.OnInit(self)
if os.path.exists("splash.jpg"): aboutService = self.InstallService(pydocview.AboutService(image=wx.Image("splash.jpg")))
if os.path.exists(TextEditorApplication.SPLASH): aboutService = self.InstallService(pydocview.AboutService(image=wx.Image(TextEditorApplication.SPLASH)))
def OnInit(self): # Call the super - this is important!!! pydocview.DocApp.OnInit(self)
if os.path.exists("splash.jpg"):
if os.path.exists(TextEditorApplication.SPLASH):
def OnInit(self): # Call the super - this is important!!! pydocview.DocApp.OnInit(self)
In addition to the usual arguments, wxFloatBar accepts keyword args of: title(string): the title that should appear on the toolbar's frame when it is floating. floatable(bool): whether user actions (i.e., dragging) can float the toolbar or not.
wxToolBar subclass which can be dragged off its frame and later replaced there. Drag on the toolbar to release it, close it like a normal window to make it return to its original position. Programmatically, call SetFloatable(true) and then Float(true) to float, Float(false) to dock.
def __init__(self,*_args,**_kwargs): """ In addition to the usual arguments, wxFloatBar accepts keyword args of: title(string): the title that should appear on the toolbar's frame when it is floating. floatable(bool): whether user actions (i.e., dragging) can float the toolbar or not. """ args = (self,) + _args apply(...
args = (self,) + _args apply(wxToolBar.__init__, args, _kwargs) if _kwargs.has_key('floatable'): self.floatable = _kwargs['floatable'] assert type(self.floatable) == type(0) else: self.floatable = 0 self.floating = 0 if _kwargs.has_key('title'): self.title = _kwargs['title'] assert type(self.title) == type("") else: se...
def __init__(self,*_args,**_kwargs): """ In addition to the usual arguments, wxFloatBar accepts keyword args of: title(string): the title that should appear on the toolbar's frame when it is floating. floatable(bool): whether user actions (i.e., dragging) can float the toolbar or not. """ args = (self,) + _args apply(...
def __init__(self,*_args,**_kwargs): """ In addition to the usual arguments, wxFloatBar accepts keyword args of: title(string): the title that should appear on the toolbar's frame when it is floating. floatable(bool): whether user actions (i.e., dragging) can float the toolbar or not. """ args = (self,) + _args apply(...
self.floatframe.SetToolBar(None) self.floatframe.Destroy() size = self.parentframe.GetSize() self.parentframe.SetSize(wxSize(0,0)) self.parentframe.SetSize(size) self.SetBackgroundColour(self.oldcolor) def OnDock(self, e): self.Float(0) if hasattr(self, 'oldpos'): del self.oldpos def OnMove(self, e): homepos = self...
if _kwargs.has_key('title'): self.title = _kwargs['title'] assert type(self.title) == type("") else: self.title = "" EVT_MOUSE_EVENTS(self, self.OnMouse) self.parentframe = wxPyTypeCast(args[1], 'wxFrame') def IsFloatable(self): return self.floatable def SetFloatable(self, float): self.floatable = float if not has...
def Float(self, bool): "Floats or docks the toolbar programmatically." if bool: self.parentframe = wxPyTypeCast(self.GetParent(), 'wxFrame') print self.title if self.title: useStyle = wxDEFAULT_FRAME_STYLE else: useStyle = wxTHICK_FRAME self.floatframe = wxFrame(self.parentframe, -1, self.title, style = useStyle)
homepos = self.parentframe.ClientToScreen(wxPoint(0,0)) floatpos = self.floatframe.GetPosition() if (abs(homepos.x - floatpos.x) < _DOCKTHRESHOLD and abs(homepos.y - floatpos.y) < _DOCKTHRESHOLD): self.Float(0) return if e.Dragging(): if not self.IsFloating(): self.Float(true) self.oldpos = (e.GetX(), e.GetY()) else: ...
self.floatframe.SetTitle(self.title) def Float(self, bool): "Floats or docks the toolbar programmatically." if bool: self.parentframe = wxPyTypeCast(self.GetParent(), 'wxFrame') print self.title if self.title: useStyle = wxDEFAULT_FRAME_STYLE else: useStyle = wxTHICK_FRAME self.float...
def OnMouse(self, e): if not self.IsFloatable(): e.Skip() return
print "Set size" else: print self.parentframe.GetToolBar() else: if self.parentframe.GetToolBar() != None: print "Removing fauxbar" self.nullbar.Reparent(self.floatframe) self.parentframe.SetToolBar(None) size = self.parentframe.GetSize() self.parentframe.SetSize(wxSize(0,0)) self.parentframe.SetSize(size)
self.SetBackgroundColour(self.oldcolor) def OnDock(self, e): self.Float(0) if hasattr(self, 'oldpos'): del self.oldpos def OnMove(self, e): homepos = self.parentframe.ClientToScreen(wxPoint(0,0)) floatpos = self.floatframe.GetPosition() if (abs(homepos.x - floatpos.x) < _DOCKTHRESHOLD and abs(homepos.y - floatpos.y...
def _SetFauxBarVisible(self, vis): return if vis: if self.parentframe.GetToolBar() == None: if not hasattr(self, 'nullbar'): self.nullbar = wxToolBar(self.parentframe, -1) print "Adding fauxbar." self.nullbar.Reparent(self.parentframe) print "Reparented." self.parentframe.SetToolBar(self.nullbar) print "Set toolbar" co...
bottomPanel.SetOwnBackroundColour("light blue")
bottomPanel.SetOwnBackgroundColour("light blue")
def __init__(self): wx.Frame.__init__(self, None, -1, "Widget Layout Tester")
self.testPanel.SetOwnBackroundColour((205, 183, 181))
self.testPanel.SetOwnBackgroundColour((205, 183, 181))
def __init__(self): wx.Frame.__init__(self, None, -1, "Widget Layout Tester")
class BasePopupFrame(wx.MiniFrame):
class BasePopupFrame(wx.Frame):
def GetSelection(self): """ Extend GetSelection to never return the root item if the root item is hidden. """ selection = super(IterableTreeCtrl, self).GetSelection() if selection == self.GetRootItem() and \ (self.GetWindowStyle() & wx.TR_HIDE_ROOT): return wx.TreeItemId() # Return an invalid TreeItemId else: return se...
fucntions, in order to reduce the clutter in the API docs.
functions, in order to reduce the clutter in the API docs.
def Notify(self): """ The timer has expired so call the callable. """ if self.callable and getattr(self.callable, 'im_self', True): self.runCount += 1 self.running = False self.result = self.callable(*self.args, **self.kwargs) self.hasRun = True if not self.running: # if it wasn't restarted, then cleanup wx.CallAfter(s...
self.printData.SetPrintMode(wx.PRINT_MODE_PRINTER)
def __init__(self, parent, frame, log): wx.Panel.__init__(self, parent, -1) self.log = log self.frame = frame
self.Bind(wx.EVT_BUTTON, self.OnPrintSetup, id=ID_Setup)
self.Bind(wx.EVT_BUTTON, self.OnPrintSetup, btn)
def __init__(self, parent, frame, log): wx.Panel.__init__(self, parent, -1) self.log = log self.frame = frame
self.Bind(wx.EVT_BUTTON, self.OnPrintPreview, id=ID_Preview)
self.Bind(wx.EVT_BUTTON, self.OnPrintPreview, btn)
def __init__(self, parent, frame, log): wx.Panel.__init__(self, parent, -1) self.log = log self.frame = frame
self.Bind(wx.EVT_BUTTON, self.OnDoPrint, id=ID_Print)
self.Bind(wx.EVT_BUTTON, self.OnDoPrint, btn)
def __init__(self, parent, frame, log): wx.Panel.__init__(self, parent, -1) self.log = log self.frame = frame
printerDialog = wx.PrintDialog(self) printerDialog.GetPrintDialogData().SetPrintData(self.printData)
data = wx.PrintDialogData(self.printData) printerDialog = wx.PrintDialog(self, data)
def OnPrintSetup(self, event): printerDialog = wx.PrintDialog(self) printerDialog.GetPrintDialogData().SetPrintData(self.printData) printerDialog.GetPrintDialogData().SetSetupDialog(True) printerDialog.ShowModal(); self.printData = printerDialog.GetPrintDialogData().GetPrintData() printerDialog.Destroy()
self.preview = wx.PrintPreview(printout, printout2, self.printData)
self.preview = wx.PrintPreview(printout, printout2, data)
def OnPrintPreview(self, event): self.log.WriteText("OnPrintPreview\n") printout = MyPrintout(self.canvas, self.log) printout2 = MyPrintout(self.canvas, self.log) self.preview = wx.PrintPreview(printout, printout2, self.printData)
pdd = wx.PrintDialogData() pdd.SetPrintData(self.printData)
pdd = wx.PrintDialogData(self.printData) pdd.SetToPage(2)
def OnDoPrint(self, event): pdd = wx.PrintDialogData() pdd.SetPrintData(self.printData) printer = wx.Printer(pdd) printout = MyPrintout(self.canvas, self.log)
if not printer.Print(self.frame, printout):
if not printer.Print(self.frame, printout, True):
def OnDoPrint(self, event): pdd = wx.PrintDialogData() pdd.SetPrintData(self.printData) printer = wx.Printer(pdd) printout = MyPrintout(self.canvas, self.log)
changeCallback= lambda x:x
changeCallback= lambda x:x, labelWidth = 0
def __init__ (self, parent, id= -1, pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.TAB_TRAVERSAL, labelText= "File Entry:", buttonText= "Browse", toolTip= "Type filename or click browse to choose file", # following are the values for a file dialog box dialogTitle = "Choose a file", startDirectory = ".", in...
self.labelWidth = labelWidth
def __init__ (self, parent, id= -1, pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.TAB_TRAVERSAL, labelText= "File Entry:", buttonText= "Browse", toolTip= "Type filename or click browse to choose file", # following are the values for a file dialog box dialogTitle = "Choose a file", startDirectory = ".", in...
label.SetSize((w+5, h))
if self.labelWidth > 0: label.SetSize((self.labelWidth+5, h)) else: label.SetSize((w+5, h))
def createLabel( self ): """Create the label/caption""" label = wx.StaticText(self, -1, self.labelText, style =wx.ALIGN_RIGHT ) font = label.GetFont() w, h, d, e = self.GetFullTextExtent(self.labelText, font) label.SetSize((w+5, h)) return label
self.GetEventHandler().OnEndSize(bound_x, bound_y)
self.GetEventHandler().OnBeginSize(bound_x, bound_y)
def OnSizingBeginDragLeft(self, pt, x, y, keys = 0, attachment = 0): self._canvas.CaptureMouse()
H = ((y3 - y2) / (x32 - x2))
H = ((y3 - y2) / (x2 - x2))
def DrawArcToEllipse(x1, y1, width1, height1, x2, y2, x3, y3): a1 = width1 / 2 b1 = height1 / 2 # Check that x2 != x3 if abs(x2 - x3)<0.05: x4 = x2 if y3>y2: y4 = y1 - sqrt((b1 * b1 - (((x2 - x1) * (x2 - x1)) * (b1 * b1) / (a1 * a1)))) else: y4 = y1 + sqrt((b1 * b1 - (((x2 - x1) * (x2 - x1)) * (b1 * b1) / (a1 * a1))))...
buttonPanel.SetAutoLayout(1)
def __init__(self, parent, log): wx.Panel.__init__(self, parent, -1) self.log = log
self.SetAutoLayout(1)
def __init__(self, parent, log): wx.Panel.__init__(self, parent, -1) self.log = log
class Tile(wx.Panel):
class Tile(wx.Window):
def __init__(self, parent, log): wx.Panel.__init__(self, parent, -1) self.log = log
wx.Panel.__init__(self, parent, -1, size=size, style=wx.CLIP_CHILDREN)
wx.Window.__init__(self, parent, -1, size=size, style=wx.CLIP_CHILDREN)
def __init__(self, parent, log, factor=1, thingToWatch=None, bgColor=None, active=1, size=(38,38), borderWidth=3): wx.Panel.__init__(self, parent, -1, size=size, style=wx.CLIP_CHILDREN) self.tile = InnerTile(self, log, factor, thingToWatch, bgColor) self.log = log sizer = wx.BoxSizer(wx.HORIZONTAL) sizer.Add(self.tile...
self.SetAutoLayout(1)
def __init__(self, parent, log, factor=1, thingToWatch=None, bgColor=None, active=1, size=(38,38), borderWidth=3): wx.Panel.__init__(self, parent, -1, size=size, style=wx.CLIP_CHILDREN) self.tile = InnerTile(self, log, factor, thingToWatch, bgColor) self.log = log sizer = wx.BoxSizer(wx.HORIZONTAL) sizer.Add(self.tile...
class InnerTile(wx.Panel):
class InnerTile(wx.Window):
def setNormal(self, event): self.SetBackgroundColour(Tile.normal) self.Refresh()
wx.Panel.__init__(self, parent, -1)
wx.Window.__init__(self, parent, -1)
def __init__(self, parent, log, factor, thingToWatch=None, bgColor=None): wx.Panel.__init__(self, parent, -1) self.log=log if bgColor: self.SetBackgroundColour(bgColor) if thingToWatch: self.factor = factor self.thingToWatch = thingToWatch self.state = 0 self.toggleOnOff() # Watch for the mouse click to en...
def __del__(self): if hasattr(self, "set_colour_val"): del self.set_colour_val
def __del__(self): if hasattr(self, "set_colour_val"): del self.set_colour_val
self.set_colour_val = wxColour(bcolour[0], bcolour[1], bcolour[2])
def SetColourValue(self, bcolour): self.set_colour_val = wxColour(bcolour[0], bcolour[1], bcolour[2]) self.set_colour = bcolour
self.SetBackgroundColour(self.set_colour_val)
self.SetBackgroundColour(self.Get_wxColour())
def SetColourValue(self, bcolour): self.set_colour_val = wxColour(bcolour[0], bcolour[1], bcolour[2]) self.set_colour = bcolour
return list( self.history )
return []
def GetHistory( self ): """Return the current history list""" if self.historyCallBack != None: return self.historyCallBack() else: return list( self.history )
result.text = wSearchText.GetValue() result.wholeword = wWholeWord.GetValue() result.casesensitive = wCase.GetValue()
result.searchText = wSearchText.GetValue() result.wholeWordsOnly = wWholeWord.GetValue() result.caseSensitive = wCase.GetValue()
def findDialog(parent=None, searchText='', wholeWordsOnly=0, caseSensitive=0): dlg = wx.Dialog(parent, -1, "Find", wx.DefaultPosition, (380, 120)) wx.StaticText(dlg, -1, 'Find what:', (7, 10)) wSearchText = wx.TextCtrl(dlg, -1, searchText, (80, 7), (195, -1)) wSearchText.SetValue(searchText) wx.Button(dlg, wx.ID_OK, "...
aFontData.SetInitialFont(font)
fontData.SetInitialFont(font)
def fontDialog(parent=None, fontData=None, font=None): if fontData is None: fontData = wx.FontData() fontData.SetColour(wx.BLACK) fontData.SetInitialFont(wx.SystemSettings.GetFont(wx.SYS_DEFAULT_GUI_FONT)) if font is not None: aFontData.SetInitialFont(font) dialog = wx.FontDialog(parent, fontData) result = DialogResu...
dialog = wx.SingleChoiceDialog(parent, message, title, lst, style)
dialog = wx.SingleChoiceDialog(parent, message, title, list(lst), style | wx.DEFAULT_DIALOG_STYLE)
def singleChoiceDialog(parent=None, message='', title='', lst=[], style=wx.OK | wx.CANCEL | wx.CENTRE): dialog = wx.SingleChoiceDialog(parent, message, title, lst, style) result = DialogResults(dialog.ShowModal()) result.selection = dialog.GetStringSelection() dialog.Destroy() return result
self.frame = frame = wx.Frame(None, -1, "Dialogs", size=(400, 200))
self.frame = frame = wx.Frame(None, -1, "Dialogs", size=(400, 240))
def OnInit(self): self.frame = frame = wx.Frame(None, -1, "Dialogs", size=(400, 200)) panel = wx.Panel(frame, -1) self.panel = panel
def __del__(self): try: self.RestoreStdio() finally: wx.PyApp.__del__(self)
def __del__(self, destroy=wx.PyApp.__del__): self.RestoreStdio() destroy(self)
def __del__(self): try: self.RestoreStdio() # Just in case the MainLoop was overridden finally: wx.PyApp.__del__(self)
_sys.stdout, _sys.stderr = self.saveStdio
try: _sys.stdout, _sys.stderr = self.saveStdio except: pass
def RestoreStdio(self): _sys.stdout, _sys.stderr = self.saveStdio
elif evt.LeftUp and self._draggedShape and self._dragState == ContinueDraggingLeft:
elif evt.LeftUp() and self._draggedShape and self._dragState == ContinueDraggingLeft:
def OnMouseEvent(self, evt): dc = wx.ClientDC(self) self.PrepareDC(dc) x, y = evt.GetLogicalPosition(dc)