def OnPaint(self, event): """This method is overridden temporarily in order to create the light manager. This is necessary because it makes sense to create the light manager only when the widget is realized. Only when the widget is realized is the VTK render window created and only then are the default lights all setup correctly. This handler is removed on the first Paint event and the default paint handler of the wxVTKRenderWindowInteractor is used instead.""" # Call the original handler (this will Show the widget) self._vtk_control.OnPaint(event) if len(self.renderer.lights) == 0: # The renderer is not ready yet, we do not do anything, and # we do not remove this callback, so that it will be called # later. return # Now create the light manager. self.light_manager = light_manager.LightManager(self) renwin = self._renwin renwin.update_traits() vtk_rw = tvtk.to_vtk(renwin) renwin.add_observer('StartEvent', messenger.send) messenger.connect(vtk_rw, 'StartEvent', self._start_event_callback) renwin.add_observer('EndEvent', messenger.send) messenger.connect(vtk_rw, 'EndEvent', self._end_event_callback) # Reset the event handler to the default since our job is done. wx.EVT_PAINT(self._vtk_control, None) # Remove the default handler. wx.EVT_PAINT(self._vtk_control, self._vtk_control.OnPaint)
def _on_close(self, event): # Might be scrollbars or other native components under # us that are generating this event if event.GetWindow() == self.control: self._gc = None wx.EVT_ERASE_BACKGROUND(self.control, None) wx.EVT_PAINT(self.control, None) wx.EVT_SIZE(self.control, None) wx.EVT_LEFT_DOWN(self.control, None) wx.EVT_LEFT_UP(self.control, None) wx.EVT_LEFT_DCLICK(self.control, None) wx.EVT_MIDDLE_DOWN(self.control, None) wx.EVT_MIDDLE_UP(self.control, None) wx.EVT_MIDDLE_DCLICK(self.control, None) wx.EVT_RIGHT_DOWN(self.control, None) wx.EVT_RIGHT_UP(self.control, None) wx.EVT_RIGHT_DCLICK(self.control, None) wx.EVT_MOTION(self.control, None) wx.EVT_ENTER_WINDOW(self.control, None) wx.EVT_LEAVE_WINDOW(self.control, None) wx.EVT_MOUSEWHEEL(self.control, None) wx.EVT_KEY_DOWN(self.control, None) wx.EVT_KEY_UP(self.control, None) wx.EVT_CHAR(self.control, None) wx.EVT_WINDOW_DESTROY(self.control, None) self.control.SetDropTarget(None) self.control = None self.component.cleanup(self) self.component.parent = None self.component.window = None self.component = None return
def __init__(self, parent): attribList = (glcanvas.WX_GL_RGBA, glcanvas.WX_GL_DOUBLEBUFFER, glcanvas.WX_GL_DEPTH_SIZE, 24, glcanvas.WX_GL_STENCIL_SIZE, 8) glcanvas.GLCanvas.__init__(self, parent, attribList=attribList) self.parent = parent self.context = glcanvas.GLContext(self) wx.EVT_PAINT(self, self.OnPaint) wx.EVT_SIZE(self, self.OnSize) wx.EVT_ERASE_BACKGROUND(self, self.OnEraseBackground) wx.EVT_MOTION(self, self.OnMouseMotion) wx.EVT_MOUSEWHEEL(self, self.OnMouseWheel) self.yaw = 30 self.pitch = 60 self.zoom = 300 self.offsetX = 0 self.offsetY = 0 self.view3D = True self.gcodeDisplayList = None self.gcodeDisplayListMade = None self.gcodeDisplayListCount = 0 self.objColor = [[1.0, 0.8, 0.6, 1.0], [0.2, 1.0, 0.1, 1.0], [1.0, 0.2, 0.1, 1.0], [0.1, 0.2, 1.0, 1.0]] self.oldX = 0 self.oldY = 0 self.dragType = '' self.tempRotate = 0
def __init__(self, parent, name): wxGLCanvas.__init__(self, parent, -1) wx.EVT_PAINT(self, self.OnPaint) self.init = 0 self.name = name self.Bind(wx.EVT_RIGHT_DOWN, self.OnRightDown) self.Bind(wx.EVT_SIZE, self.OnSize)
def _create_control(self, parent): # Get the splash screen image. image = self.image.create_image() splash_screen = wx.SplashScreen( # The bitmap to display on the splash screen. image.ConvertToBitmap(), # Splash Style. wx.SPLASH_NO_TIMEOUT | wx.SPLASH_CENTRE_ON_SCREEN, # Timeout in milliseconds (we don't currently timeout!). 0, # The parent of the splash screen. parent, # wx Id. -1, # Window style. style=wx.SIMPLE_BORDER | wx.FRAME_NO_TASKBAR) # By default we create a font slightly bigger and slightly more italic # than the normal system font ;^) The font is used inside the event # handler for 'EVT_PAINT'. self._wx_default_text_font = new_font_like( wx.NORMAL_FONT, point_size=wx.NORMAL_FONT.GetPointSize() + 1, style=wx.ITALIC) # This allows us to write status text on the splash screen. wx.EVT_PAINT(splash_screen, self._on_paint) return splash_screen
def __init__(self, parent, id, xvals, data, log=False, size =(200, 100), pos=(0,0), threshMode= False): wx.Panel.__init__(self, parent, id, size=size, pos=pos, style=wx.BORDER_SUNKEN) self.dragging = None self.binSize=None self.isinit = False self.textSize = 10 self.log = log self.left_margin = 20 self.threshMode = threshMode self.SetData(xvals, data) wx.EVT_PAINT(self, self.OnPaint) wx.EVT_SIZE(self, self.OnSize) #wx.EVT_LEFT_DOWN(self, self.OnLeftDown) #wx.EVT_LEFT_UP(self, self.OnLeftUp) #wx.EVT_MOTION(self, self.OnMouseMove) #wx.EVT_KEY_DOWN(self, self.OnKeyPress) self.isinit = True
def __init__(self, parent, bitmap, selected=None, handler=None, padding=10): """ Initializes the object. """ wx.Window.__init__(self, parent, -1, size=wx.Size(bitmap.GetWidth() + padding, bitmap.GetHeight() + padding)) self._bitmap = bitmap self._selected = selected self._handler = handler self._mouse_over = False self._button_down = False # Set up the 'paint' event handler: wx.EVT_PAINT(self, self._on_paint) # Set up mouse event handlers: wx.EVT_LEFT_DOWN(self, self._on_left_down) wx.EVT_LEFT_UP(self, self._on_left_up) wx.EVT_ENTER_WINDOW(self, self._on_enter) wx.EVT_LEAVE_WINDOW(self, self._on_leave)
def __init__(self, parent): attribList = (glcanvas.WX_GL_RGBA, glcanvas.WX_GL_DOUBLEBUFFER, glcanvas.WX_GL_DEPTH_SIZE, 24, glcanvas.WX_GL_STENCIL_SIZE, 8, 0) glcanvas.GLCanvas.__init__(self, parent, style=wx.WANTS_CHARS, attribList = attribList) self._base = self self._focus = None self._container = None self._container = glGuiContainer(self, (0,0)) self._shownError = False self._context = glcanvas.GLContext(self) self._glButtonsTexture = None self._glRobotTexture = None self._buttonSize = 64 self._animationList = [] self.glReleaseList = [] self._refreshQueued = False self._idleCalled = False wx.EVT_PAINT(self, self._OnGuiPaint) wx.EVT_SIZE(self, self._OnSize) wx.EVT_ERASE_BACKGROUND(self, self._OnEraseBackground) wx.EVT_LEFT_DOWN(self, self._OnGuiMouseDown) wx.EVT_LEFT_DCLICK(self, self._OnGuiMouseDown) wx.EVT_LEFT_UP(self, self._OnGuiMouseUp) wx.EVT_RIGHT_DOWN(self, self._OnGuiMouseDown) wx.EVT_RIGHT_DCLICK(self, self._OnGuiMouseDown) wx.EVT_RIGHT_UP(self, self._OnGuiMouseUp) wx.EVT_MIDDLE_DOWN(self, self._OnGuiMouseDown) wx.EVT_MIDDLE_DCLICK(self, self._OnGuiMouseDown) wx.EVT_MIDDLE_UP(self, self._OnGuiMouseUp) wx.EVT_MOTION(self, self._OnGuiMouseMotion) wx.EVT_CHAR(self, self._OnGuiKeyChar) wx.EVT_KILL_FOCUS(self, self.OnFocusLost) wx.EVT_IDLE(self, self._OnIdle)
def setupCallbacks(self): """Setup various callbacks for this context Binds most of the wxPython event types to callbacks on this object, which allows interactive sub-classes to easily manage the bindings without needing any wxPython-specific logic. """ if not self.init: self.init = 1 # Bind the wxPython background erase event # Without this binding, the canvas will tend to flicker wx.EVT_ERASE_BACKGROUND(self, self.wxOnEraseBackground) # Handle resizing of the window wx.EVT_SIZE(self, self.wxOnSize) # Handle requests to display this canvas wx.EVT_PAINT(self, self.wxOnPaint) # Handle keyboard events... wx.EVT_KEY_DOWN(self, self.wxOnKeyDown) wx.EVT_KEY_UP(self, self.wxOnKeyUp) wx.EVT_CHAR(self, self.wxOnCharacter) # Handle mouse events... wx.EVT_LEFT_DOWN(self, self.wxOnMouseButton) wx.EVT_RIGHT_DOWN(self, self.wxOnMouseButton) wx.EVT_MIDDLE_DOWN(self, self.wxOnMouseButton) wx.EVT_LEFT_UP(self, self.wxOnMouseButton) wx.EVT_RIGHT_UP(self, self.wxOnMouseButton) wx.EVT_MIDDLE_UP(self, self.wxOnMouseButton) wx.EVT_MOTION(self, self.wxOnMouseMove) if hasattr(self, 'OnIdle'): wx.EVT_IDLE(self, self.wxOnIdle)
def __init__(self, fftsink, parent, id=-1, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE, name=""): wx.Panel.__init__(self, parent, id, pos, size, style, name) self.set_baseband_freq = fftsink.set_baseband_freq self.fftsink = fftsink self.bm = wx.EmptyBitmap(self.fftsink.fft_size, 300, -1) self.scale_factor = 5.0 # FIXME should autoscale, or set this dc1 = wx.MemoryDC() dc1.SelectObject(self.bm) dc1.Clear() self.pens = self.make_pens() wx.EVT_PAINT(self, self.OnPaint) wx.EVT_CLOSE(self, self.on_close_window) EVT_DATA_EVENT(self, self.set_data) self.build_popup_menu() wx.EVT_CLOSE(self, self.on_close_window) self.Bind(wx.EVT_RIGHT_UP, self.on_right_click) self.input_watcher = input_watcher(fftsink.msgq, fftsink.fft_size, self)
def __init__(self, parent=None, *args, **kwargs): """Initialize the CanvasFrame. The frame uses ExtendedToolbar as a toolbar, which has a save data button and a close button on the toolbar in addition to the normal buttons. args -- argument list kwargs -- keyword argument list """ wx.Frame.__init__(self, parent, -1, 'ExtendedPlotFrame', size=(550, 350)) # figsize in inches self.figure = Figure(figsize=(0.5, 0.5), dpi=72) # we will manage view scale ourselves self.subplot = self.figure.add_subplot(111, autoscale_on=False) self.canvas = FigureCanvas(self, -1, self.figure) # Introspection data self.dirname = '' self.filename = '' self.sizer = wx.BoxSizer(wx.VERTICAL) self.sizer.Add(self.canvas, 1, wx.TOP | wx.LEFT | wx.EXPAND) self.toolbar = ExtendedToolbar(self.canvas) self.toolbar.Realize() self.coordLabel = wx.StaticText(self, -1, style=wx.ALIGN_RIGHT | wx.NO_BORDER) # Place coordinates textbox in a horizontal sizer next to the toolbar. barSizer = wx.BoxSizer(wx.HORIZONTAL) self.sizer.Add(barSizer, 0, wx.EXPAND | wx.CENTER) barSizer.Add(self.toolbar, 0, wx.CENTER) barSizer.Add((20, 10), 0) barSizer.Add(self.coordLabel, 0, wx.CENTER) # update the axes menu on the toolbar self.toolbar.update() self.SetSizer(self.sizer) self.Fit() self.SetSize((600, 400)) # Use toolbar's color for coordinates label background. self.SetBackgroundColour(self.toolbar.GetBackgroundColour()) # FIXME -- toolbar background color does not match on Mac OS X. # Use GIMP - picked color until a proper way is found. if wx.Platform == '__WXMAC__': self.SetBackgroundColour((200, 200, 200, 255)) self.canvas.mpl_connect('motion_notify_event', self.UpdateStatusBar) self.canvas.mpl_connect('key_press_event', self.mplKeyPress) wx.EVT_PAINT(self, self.OnPaint) wx.EVT_TOOL(self, DATA_SAVE_ID, self.savePlotData) wx.EVT_CLOSE(self, self.onClose) self.datalims = {}
def __init__(self, parent, *args, **kwargs): wx.Panel.__init__(self, parent, *args, **kwargs) self.parent = parent wx.EVT_PAINT(self, self.OnPaint) wx.EVT_ERASE_BACKGROUND(self, self.DoNix)
def __init__(self, parent, id=-1, pos=wx.DefaultPosition, size=wx.DefaultSize, label=None): """LabelCtrl constructor. Notice that each change of the object implies a refresh. Non-wxpython related parameter: - label (Label) the Label of an annotation. It is never modified. """ wx.Window.__init__(self, parent, id, pos, size, STYLE) self.SetBackgroundStyle(wx.BG_STYLE_CUSTOM) self.SetDoubleBuffered(True) # Members, Initializations self.Reset(size) self._label = label self._underlined = False # self.SetValue(label) # Bind the events related to our control wx.EVT_PAINT(self, self.OnPaint) wx.EVT_ERASE_BACKGROUND(self, lambda event: None) wx.EVT_MOUSE_EVENTS(self, self.OnMouseEvents)
def __init__(self, parent): # make sure the NO_FULL_REPAINT_ON_RESIZE style flag is set. # kwargs['style'] = kwargs.setdefault('style', wx.NO_FULL_REPAINT_ON_RESIZE) | wx.NO_FULL_REPAINT_ON_RESIZE wx.Panel.__init__(self, parent) wx.EVT_PAINT(self, self.OnPaint) wx.EVT_SIZE(self, self.OnSize) self.OnSize(None)
def __init__(self, parent, **traits): """ Creates a new widget. """ # Base class constructors. super(ImageWidget, self).__init__(**traits) # Add some padding around the image. size = (self.bitmap.GetWidth() + 10, self.bitmap.GetHeight() + 10) # Create the toolkit-specific control. self.control = wx.Window(parent, -1, size=size) self.control.__tag__ = 'hack' self._mouse_over = False self._button_down = False # Set up mouse event handlers: wx.EVT_ENTER_WINDOW(self.control, self._on_enter_window) wx.EVT_LEAVE_WINDOW(self.control, self._on_leave_window) wx.EVT_LEFT_DCLICK(self.control, self._on_left_dclick) wx.EVT_LEFT_DOWN(self.control, self._on_left_down) wx.EVT_LEFT_UP(self.control, self._on_left_up) wx.EVT_PAINT(self.control, self._on_paint) # Pens used to draw the 'selection' marker: # ZZZ: Make these class instances when moved to the wx toolkit code. self._selectedPenDark = wx.Pen( wx.SystemSettings_GetColour(wx.SYS_COLOUR_3DSHADOW), 1, wx.SOLID) self._selectedPenLight = wx.Pen( wx.SystemSettings_GetColour(wx.SYS_COLOUR_3DHIGHLIGHT), 1, wx.SOLID) return
def __init__(self, parent, color=wx.RED_BRUSH): wx.Window.__init__(self, parent, -1, wx.DefaultPosition, size=(324, 25)) wx.EVT_PAINT(self, self.OnPaint)
def __init__(self): wx.Menu.__init__(self) image = wx.Image('gfx/digital-panda-online-1616.png', wx.BITMAP_TYPE_ANY) self.bitmap = image.ConvertToBitmap() wx.EVT_PAINT(self, self.on_paint)
def __init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, tier=None): """ Constructor. Non-wxpython related parameter: - tier (Tier) the Tier to draw (see annotationdata library for details). """ self._panectrl = None self._dictanns = {} self._tier = tier wx.Window.__init__(self, parent, id, pos, size, STYLE) self.SetBackgroundStyle(wx.BG_STYLE_CUSTOM) self.SetDoubleBuffered(True) self.Reset(size) self._buildpanectrl() # Bind the events related to our control: wx.EVT_PAINT(self, self.OnPaint) wx.EVT_ERASE_BACKGROUND(self, lambda event: None)
def __init__(self, parent, image, glCanvas, do, chan=0, zdim=2): wx.Panel.__init__(self, parent, -1, size=parent.Size) self.image = image self.glCanvas = glCanvas self.do = do self.chan = chan self.zdim = zdim wx.EVT_PAINT(self, self.OnPaint) wx.EVT_SIZE(self, self.OnSize) wx.EVT_MOUSEWHEEL(self, self.OnWheel) wx.EVT_KEY_DOWN(self, self.OnKeyPress) wx.EVT_LEFT_DOWN(self, self.OnLeftDown) wx.EVT_LEFT_UP(self, self.OnLeftUp) wx.EVT_MIDDLE_DOWN(self, self.OnMiddleDown) wx.EVT_MIDDLE_UP(self, self.OnMiddleUp) wx.EVT_MOTION(self, self.OnMotion) self.selecting = False self.panning = False self.do.WantChangeNotification.append(self.Refresh)
def __init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, text=""): """ Constructor. Non-wxpython related parameters: @param text (str) the text to write in the pane. """ wx.Window.__init__(self, parent, id, pos, size, STYLE) self.SetBackgroundStyle(wx.BG_STYLE_CUSTOM) self.SetDoubleBuffered(True) # Members, Initializations self._text = text self.SetToolTip(wx.ToolTip(self.__tooltip())) self.Reset(size) # Bind the events related to our control wx.EVT_PAINT(self, self.OnPaint) wx.EVT_ERASE_BACKGROUND(self, lambda event: None) wx.EVT_MOUSE_EVENTS(self, self.OnMouseEvents)
def create_widget(self): self.widget = wx.Window(self.parent.widget, self.id, size=self.__size, style=wx.SIMPLE_BORDER) self.widget.GetBestSize = self.widget.GetSize wx.EVT_PAINT(self.widget, self.on_paint)
def __init__(self, editor, parent, wid=-1, pos=wx.DefaultPosition, size=wx.DefaultSize): super(KeyBindingCtrl, self).__init__(parent, wid, pos, size, style=wx.CLIP_CHILDREN | wx.WANTS_CHARS) # Save the reference to the controlling editor object: self.editor = editor # Indicate we don't have the focus right now: editor.has_focus = False # Set up the 'erase background' event handler: wx.EVT_ERASE_BACKGROUND(self, self._on_erase_background) # Set up the 'paint' event handler: wx.EVT_PAINT(self, self._paint) # Set up the focus change handlers: wx.EVT_SET_FOCUS(self, self._get_focus) wx.EVT_KILL_FOCUS(self, self._lose_focus) # Set up mouse event handlers: wx.EVT_LEFT_DOWN(self, self._set_focus) wx.EVT_LEFT_DCLICK(self, self._clear_contents) # Handle key events: wx.EVT_CHAR(self, self._on_char)
def __init__(self, parent=None, id=-1, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.BORDER, name="ShapeCanvas"): wx.ScrolledWindow.__init__(self, parent, id, pos, size, style, name) self.diagram = None self._dragState = NoDragging self._draggedShape = None self._oldDragX = 0 self._oldDragY = 0 self._firstDragX = 0 self._firstDragY = 0 self._checkTolerance = True # this MAY actually be private... self.mouseTolerance = DEFAULT_MOUSE_TOLERANCE self.avoidRefreshes = False self.snapToGrid = False self.gridSpacing = 25.0 wx.EVT_PAINT(self, self.OnPaint) wx.EVT_MOUSE_EVENTS(self, self.OnMouseEvent)
def __init__(self, width, height, alpha = symbol, mirr = 0, parent = None): """ Initialise. width and height define the physical size of the CRT in cm. """ wx.Frame.__init__ (self, parent, -1, _("Snellen Chart")) # width/Y is screen size (X/Y in cm) #wx.SystemSettings.GetMetric(wx.SYS_SCREEN_X) # screensizes = {_("14 inch"):(28, 21), _("16 inch"):(30, 23)} self.screen_width_cm = width self.screen_height_cm = height self.screen_width_pixel = 0 self.screen_height_pixel = 0 self.standard_patient_chart_distances = [3, 5, 6, 7.5, 9, 12, 15, 18, 24, 30, 48, 60] # in metres self.mirror = mirr self.alphabet = alpha wx.EVT_CLOSE (self, self.OnClose) wx.EVT_KEY_DOWN (self, self.OnKeyUp) wx.EVT_LEFT_UP (self, self.OnLeftDown) wx.EVT_RIGHT_UP (self, self.OnRightDown) wx.EVT_LEFT_DCLICK (self, self.OnDClick) wx.EVT_PAINT (self, self.OnPaint) # wx.EVT_WINDOW_CREATE (self, self.OnCreate) self.ShowFullScreen(1)
def __init__(self, parent, mouseOverFilename, mouseOutFilename=None, parentImage=None): wx.Panel.__init__(self, parent, -1) self.Bind(wx.EVT_MOUSE_EVENTS, self.mouseAction) self.onbitmap = wx.Bitmap(mouseOverFilename, wx.BITMAP_TYPE_ANY) if mouseOutFilename: self.offbitmap = wx.Bitmap(mouseOutFilename, wx.BITMAP_TYPE_ANY) self.bitmap = self.offbitmap else: self.offbitmap = self.onbitmap self.bitmap = self.onbitmap self.parentImage = parentImage self.SetMinSize(self.onbitmap.GetSize()) self.SetSize(self.onbitmap.GetSize()) wx.EVT_PAINT(self, self.OnPaint) self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnErase) self.Refresh(True) self.Update()
def __init__(self, parent, id=-1, text=wx.EmptyString, #text in the ticker fgcolor = wx.BLACK, #text/foreground color bgcolor = wx.WHITE, #background color start=True, #if True, the ticker starts immediately ppf=2, #pixels per frame fps=20, #frames per second direction="rtl", #direction of ticking, rtl or ltr pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.NO_BORDER, name="Ticker" ): wx.PyControl.__init__(self, parent, id=id, pos=pos, size=size, style=style, name=name) self.timer = wx.Timer(owner=self) self._extent = (-1, -1) #cache value for the GetTextExtent call self._offset = 0 self._fps = fps #frames per second self._ppf = ppf #pixels per frame self.SetDirection(direction) self.SetText(text) self.SetInitialSize(size) self.SetForegroundColour(fgcolor) self.SetBackgroundColour(bgcolor) wx.EVT_TIMER(self, -1, self.OnTick) wx.EVT_PAINT(self, self.OnPaint) wx.EVT_ERASE_BACKGROUND(self, self.OnErase) if start: self.Start()
def __init__(self, *args, **kw): self._world = kw['world'] del kw['world'] wx.Window.__init__(self, *args, **kw) self._spacing = 20 self._offset = 20 self.SetBestSize(self.size()) wx.EVT_PAINT(self, self.OnPaint) self.Bind(wx.EVT_LEFT_DOWN, self.OnClick, self) self.Bind(wx.EVT_CHAR, self.OnKey, self) self.SetFocus() self._bgBrush = wx.Brush('white') self._gridPen = wx.Pen('black') self._gridPen.SetWidth(0.3) self._gridPen.SetCap(wx.CAP_PROJECTING) self._wallPen1 = wx.Pen('black') self._wallPen1.SetWidth(6) self._wallPen1.SetCap(wx.CAP_PROJECTING) self._wallPen2 = wx.Pen('red') self._wallPen2.SetWidth(2) self._wallPen2.SetCap(wx.CAP_PROJECTING) self._stoneBrush1 = wx.Brush('cyan') self._stoneBrush2 = wx.Brush('white') self._textBrush = wx.Brush('black') self._font = wx.SystemSettings.GetFont(wx.SYS_DEFAULT_GUI_FONT) self._font.SetWeight(wx.BOLD) self._font.SetPointSize(18) self._robotBrush = wx.Brush('blue') self._robotPen = wx.Pen('blue') self._robotPen.SetWidth(4) self._robotPen.SetCap(wx.CAP_BUTT) self._trailPen = wx.Pen('grey') self._trailPen.SetWidth(1)
def __init__(self, parent, id): """Create a new shadow. """ wx.Panel.__init__(self, parent, id) self.sh_width = gmGuiBroker.config['main.shadow.width'] wx.EVT_SIZE(self, self.OnSize) wx.EVT_PAINT(self, self.OnPaint)
def __init__(self, parent, id=-1, value=0, min_value=0, max_value=100, start_value=0, stop_value=100, value_names=None, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.TAB_TRAVERSAL | wx.NO_BORDER, name=SLIDER_CTL_STR): super(SliderCtl, self).__init__(parent, id, pos, size, style, name) self.border = 10 self.tick_length = 5 self.__value = value self.__min_value = min_value self.__max_value = max_value self.__start_value = start_value self.__stop_value = stop_value self.value_names = value_names self.BackgroundColour = wx.RED wx.EVT_PAINT(self, self.on_paint) wx.EVT_ERASE_BACKGROUND(self, self.on_erase_background) self.Bind(wx.EVT_SIZE, self.on_size, self) self.Bind(wx.EVT_LEFT_DOWN, self.on_left_down, self) self.Bind(wx.EVT_LEFT_UP, self.on_left_up) self.Bind(wx.EVT_MOTION, self.on_motion)
def __init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize): """ Constructor. """ style=wx.NO_BORDER|wx.NO_FULL_REPAINT_ON_RESIZE|wx.CLIP_CHILDREN|wx.WANTS_CHARS wx.Window.__init__(self, parent, id, pos, size, style) self.SetDoubleBuffered(True) self.SetBackgroundStyle(wx.BG_STYLE_CUSTOM) self.Initialize(size) # Bind the events related to our control: # Only refresh drawing when resizing is finished wx.EVT_PAINT(self, self.OnPaint) wx.EVT_SIZE(self, self.OnSize) wx.EVT_IDLE(self, self.OnIdle) wx.EVT_CLOSE(self, self.OnClose) wx.EVT_ERASE_BACKGROUND(self, lambda event: None) # Bind the events related to this control: wx.EVT_LEFT_UP(self, self.OnMouseLeftUp) # Start the background redraw timer. # This is optional, but it gives the double-buffered contents a # chance to redraw even when idle events are disabled (like during # resize and scrolling) self.redrawTimer = wx.Timer(self) self.redrawTimer.Start(500)