Best Python code snippet using ATX
mplwidget.py
Source:mplwidget.py
1from matplotlib.backends.backend_qt5agg import (NavigationToolbar2QT as NavigationToolbar)2from matplotlib.backends.backend_qt5agg import FigureCanvas3from matplotlib.figure import Figure4from PyQt5.QtWidgets import *56class MplWidget(QWidget):7 def __init__(self, parent=None):8 QWidget.__init__(self, parent)9 self.canvas = FigureCanvas(Figure())1011 vertical_layout = QVBoxLayout()12 vertical_layout.addWidget(self.canvas)13 #ToolBar1.addWidget(NavigationToolbar(self.canvas, self))1415 self.canvas.axes = self.canvas.figure.add_subplot(111)16 self.setLayout(vertical_layout)1718 def make_ToolBar (self, layout):19 layout.addWidget(NavigationToolbar(self.canvas, self))2021class MplWidget2(QWidget):2223 def __init__(self, parent=None):24 QWidget.__init__(self, parent)2526 self.canvas = FigureCanvas(Figure())2728 vertical_layout = QVBoxLayout()29 vertical_layout.addWidget(self.canvas)30 #vertical_layout.addWidget(NavigationToolbar(self.canvas, self))3132 self.canvas.axes = self.canvas.figure.add_subplot(111)33 self.setLayout(vertical_layout)3435 def make_ToolBar (self, layout):36 layout.addWidget(NavigationToolbar(self.canvas, self))373839class MplWidget3(QWidget):4041 def __init__(self, parent=None):42 QWidget.__init__(self, parent)4344 self.canvas = FigureCanvas(Figure())4546 vertical_layout = QVBoxLayout()47 vertical_layout.addWidget(self.canvas)48 #vertical_layout.addWidget(NavigationToolbar(self.canvas, self))4950 self.canvas.axes = self.canvas.figure.add_subplot(111)51 self.setLayout(vertical_layout)5253 def make_ToolBar (self, layout):54 layout.addWidget(NavigationToolbar(self.canvas, self))
...
test1.py
Source:test1.py
...9 self.set_icon(img)10 self.add_handler("destroy", self.close_cb)11 12 self.make_menu()13 self.make_toolbar()14 for child in self.get_children():15 print child.get_type()16 17 self.canvas = cg.canvas(self, cg.bounds(0,0,300,300))18 self.canvas.add_handler("redraw", self.draw_cb)19 self.canvas.redraw()20 21 def draw_cb(self,o,e):22 print "draw()"23 buf = "\00" * 200 * 200 * 324 self.canvas.draw_rgb_buffer(0,0,200,200, buf)25 #self.canvas.fill_rect(0,0,200,200,0,0,0,1) 26 27 def make_menu(self):28 self.mb = cg.menubar(self)29 file_menu = self.mb.append_item(None, None, "File")30 file_quit = self.mb.append_item(file_menu, cg.stock.get_image("system-log-out", cg.stock.cStockMenu), "Quit")31 self.mb.add_key_binding(file_quit, "Q", cg.menubar.ModifierCommand)32 file_quit.add_handler("pushed", self.close_cb)33 34 def make_toolbar(self):35 pass36 #self.tb = cg.toolbar(self)37 #prev = self.tb.append_icon(cg.stock.get_image("go-previous"),"None","Previous")38 #next = self.tb.append_icon(cg.stock.get_image("go-next"),None,"Next")39 40 def close_cb(self,o,e):41 claro.base.shutdown()42 43cb.init()44cg.init()45w = test_window(None,cg.bounds(0,0,300,300))46w.show()47w.focus()48cb.loop()
efe99e4b127b8000673c42dc98dc679225c6ab65.py
Source:efe99e4b127b8000673c42dc98dc679225c6ab65.py
...3class GUI(wx.Frame):4 def __init__(self, parent):5 wx.Frame.__init__(self, parent)6 self.make_menu()7 self.make_toolbar()8 self.do_bindings()9 10 # comment out the bind to see how it causes my problem11 self.Bind(wx.EVT_MENU_OPEN, lambda x: x)12 self.SetExtraStyle(wx.WS_EX_PROCESS_UI_UPDATES)13 def make_menu(self):14 menu = wx.MenuBar()15 edit = wx.Menu()16 edit.Append(wx.ID_UNDO, "Undo")17 edit.Append(wx.ID_REDO, "Redo")18 menu.Append(edit, "Edit")19 self.SetMenuBar(menu)20 def make_toolbar(self):21 self.toolbar = self.CreateToolBar()22 ids = [wx.ID_UNDO, wx.ID_REDO]23 arts = [wx.ART_UNDO, wx.ART_REDO]24 for _id, art_id in zip(ids, arts):25 art = wx.ArtProvider.GetBitmap(art_id, wx.ART_TOOLBAR)26 self.toolbar.AddSimpleTool(_id, art)27 self.toolbar.Realize()28 def do_bindings(self):29 self.Bind(wx.EVT_UPDATE_UI, self.update_menus, id=wx.ID_UNDO)30 self.Bind(wx.EVT_UPDATE_UI, self.update_menus, id=wx.ID_REDO)31 def update_menus(self, event):32 event.Enable(False)33#------------------------------------------34app = wx.App()...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!