我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用wx.DefaultPosition()。
def __init__( self, parent ): wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = u"Encrypted Files", pos = wx.DefaultPosition, size = wx.Size( 600,400 ), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL ) self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize ) BodySizer = wx.BoxSizer( wx.VERTICAL ) self.m_panel4 = wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) TextCtrlSizer = wx.BoxSizer( wx.VERTICAL ) self.EncryptedFilesTextCtrl = wx.TextCtrl( self.m_panel4, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.TE_DONTWRAP|wx.TE_MULTILINE|wx.TE_READONLY ) TextCtrlSizer.Add( self.EncryptedFilesTextCtrl, 1, wx.ALL|wx.EXPAND, 5 ) self.m_panel4.SetSizer( TextCtrlSizer ) self.m_panel4.Layout() TextCtrlSizer.Fit( self.m_panel4 ) BodySizer.Add( self.m_panel4, 1, wx.EXPAND |wx.ALL, 5 ) self.SetSizer( BodySizer ) self.Layout() self.Centre( wx.BOTH )
def __init__(self): wx.Frame.__init__(self, None, pos=wx.DefaultPosition, size=wx.Size(450, 100), style=wx.MINIMIZE_BOX | wx.SYSTEM_MENU | wx.CAPTION | wx.CLOSE_BOX | wx.CLIP_CHILDREN, title="BRUNO") panel = wx.Panel(self) ico = wx.Icon('boy.ico', wx.BITMAP_TYPE_ICO) self.SetIcon(ico) my_sizer = wx.BoxSizer(wx.VERTICAL) lbl = wx.StaticText(panel, label="Bienvenido Sir. How can I help you?") my_sizer.Add(lbl, 0, wx.ALL, 5) self.txt = wx.TextCtrl(panel, style=wx.TE_PROCESS_ENTER, size=(400, 30)) self.txt.SetFocus() self.txt.Bind(wx.EVT_TEXT_ENTER, self.OnEnter) my_sizer.Add(self.txt, 0, wx.ALL, 5) panel.SetSizer(my_sizer) self.Show() speak.Speak('''Welcome back Sir, Broono at your service.''')
def __init__(self, parent): self.parent = parent wxskinDialog.__init__(self, parent, -1, "Select card reader", wx.DefaultPosition, wx.DefaultSize, wx.DEFAULT_DIALOG_STYLE) self.state = SIM_STATE_DISCONNECTED self.serialport = None self.readerName = "" self.chv1_enabled = 0 self.chv1_tries_left = 0 self.chv1 = "" self.chv2_enabled = 0 self.chv2_tries_left = 0 self.chv2 = "" self.FDN_available = 0 self.phonebook = {} self.createLayout() # Don't show the select reader dialog yet self.Show(0)
def __init__(self, parent, id, title, message, download_url, size=wx.DefaultSize, pos=wx.DefaultPosition, style=wx.DEFAULT_DIALOG_STYLE, name='dialog'): wx.Dialog.__init__(self, parent, id, title, pos, size, style, name) label = wx.StaticText(self, label=message) button = wx.Button(self, id=wx.ID_OK, label="Close") button.SetDefault() line = wx.StaticLine(self, wx.ID_ANY, size=(20, -1), style=wx.LI_HORIZONTAL) download_ctrl = hl.HyperLinkCtrl(self, wx.ID_ANY, download_url, URL=download_url) sizer = wx.BoxSizer(wx.VERTICAL) button_sizer = wx.StdDialogButtonSizer() button_sizer.AddButton(button) button_sizer.Realize() sizer.Add(label, 0, wx.ALIGN_CENTER|wx.ALL, 5) sizer.Add(download_ctrl, 0, wx.ALL, 10) sizer.Add(line, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.RIGHT|wx.TOP, 5) sizer.Add(button_sizer, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5) self.SetSizer(sizer) sizer.Fit(self)
def __init__(self, parent, size=wx.Size(128,128), dpi=None, **kwargs): self.size = size self.dragging_curview_is_active = False wx.Panel.__init__(self, parent, wx.ID_ANY, wx.DefaultPosition, size, 0, **kwargs) self.ztv_frame = self.GetTopLevelParent() self.figure = Figure(None, dpi) self.axes = self.figure.add_axes([0., 0., 1., 1.]) self.curview_rectangle = Rectangle((0, 0), 1, 1, color='orange', fill=False, zorder=100) self.axes.add_patch(self.curview_rectangle) self.canvas = FigureCanvasWxAgg(self, -1, self.figure) self.overview_zoom_factor = 1. self._SetSize() self.set_xy_limits() self.axes_widget = AxesWidget(self.figure.gca()) self.axes_widget.connect_event('button_press_event', self.on_button_press) self.axes_widget.connect_event('button_release_event', self.on_button_release) self.axes_widget.connect_event('motion_notify_event', self.on_motion) pub.subscribe(self.redraw_overview_image, 'redraw-image') pub.subscribe(self.redraw_box, 'primary-xy-limits-changed')
def buildToolsBar(parent, datas): box = wx.BoxSizer( wx.HORIZONTAL ) #toolsbar = wx.ToolBar( parent, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TB_HORIZONTAL ) toolsbar = wx.Panel( parent, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) toolsbar.SetSizer( box ) add_tools(toolsbar, datas[1][0][1], None) gifpath = os.path.join(root_dir, "tools/drop.gif") btn = wx.BitmapButton(toolsbar, wx.ID_ANY, make_bitmap(wx.Bitmap(gifpath)), wx.DefaultPosition, (32, 32), wx.BU_AUTODRAW|wx.RAISED_BORDER) box.Add(btn) btn.Bind(wx.EVT_LEFT_DOWN, lambda x:menu_drop(parent, toolsbar, datas, btn, x)) add_tools(toolsbar, datas[1][1][1]) return toolsbar
def add_num(self, rang, accu, title, key, unit): sizer = wx.BoxSizer( wx.HORIZONTAL ) lab_title = wx.StaticText( self, wx.ID_ANY, title, wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTRE ) lab_title.Wrap( -1 ) sizer.Add( lab_title, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) ctrl = NumCtrl(self, rang, accu) self.ctrl_dic[key] = ctrl ctrl.Bind(wx.EVT_KEY_UP, lambda x : self.para_changed(key)) sizer.Add( ctrl, 2, wx.ALL, 5 ) lab_unit = wx.StaticText( self, wx.ID_ANY, unit, wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTRE ) lab_unit.Wrap( -1 ) sizer.Add( lab_unit, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.tus.append((lab_title, lab_unit)) self.lst.Add( sizer, 0, wx.EXPAND, 5 )
def add_color(self, title, key, unit): sizer = wx.BoxSizer( wx.HORIZONTAL ) lab_title = wx.StaticText( self, wx.ID_ANY, title, wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTRE ) lab_title.Wrap( -1 ) sizer.Add( lab_title, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) ctrl = ColorCtrl(self) self.ctrl_dic[key] = ctrl ctrl.Bind(wx.EVT_KEY_UP, lambda x : self.para_changed(key)) sizer.Add( ctrl, 2, wx.ALL, 5 ) lab_unit = wx.StaticText( self, wx.ID_ANY, unit, wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTRE ) lab_unit.Wrap( -1 ) sizer.Add( lab_unit, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.tus.append((lab_title, lab_unit)) self.lst.Add( sizer, 0, wx.EXPAND, 5 )
def add_slide(self, rang, title, key, unit): sizer = wx.BoxSizer( wx.HORIZONTAL ) lab_title = wx.StaticText( self, wx.ID_ANY, title, wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTRE ) lab_title.Wrap( -1 ) sizer.Add( lab_title, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) iswin = platform.system() == 'Windows' lab = wx.SL_VALUE_LABEL if iswin else wx.SL_LABELS ctrl = wx.Slider( self, wx.ID_ANY, 50, rang[0], rang[1], wx.DefaultPosition, wx.Size( -1,-1 ), wx.SL_HORIZONTAL|lab ) self.ctrl_dic[key] = ctrl ctrl.Bind(wx.EVT_SCROLL, lambda x : self.para_changed(key)) sizer.Add( ctrl, 2, wx.ALL, 5 ) lab_unit = wx.StaticText( self, wx.ID_ANY, unit, wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTRE ) lab_unit.Wrap( -1 ) sizer.Add( lab_unit, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.tus.append((lab_title, lab_unit)) self.lst.Add( sizer, 0, wx.EXPAND, 5 )
def gray(self, hist): panel = wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) back = wx.BoxSizer( wx.VERTICAL ) back.Add(panel, 1, wx.EXPAND) sizer = wx.BoxSizer( wx.VERTICAL ) histc = HistCanvas(panel) histc.set_hist(hist) txt = wx.StaticText( panel, wx.ID_ANY, 'Channel:'+'Gray', wx.DefaultPosition, wx.DefaultSize, 0 ) sizer.Add( txt, 0, wx.LEFT|wx.RIGHT, 8 ) sizer.Add( histc, 0, wx.LEFT|wx.RIGHT, 8 ) mean, lim = np.dot(hist, range(256))/hist.sum(), np.where(hist>0)[0] sta = 'Statistic: Mean:%s Min:%s Max:%s'%(mean.round(1), lim.min(), lim.max()) txt = wx.StaticText( panel, wx.ID_ANY, sta, wx.DefaultPosition, wx.DefaultSize, 0 ) sizer.Add( txt, 0, wx.LEFT|wx.RIGHT|wx.BOTTOM, 8 ) panel.SetSizer( sizer ) self.SetSizer(back) self.Fit()
def __init__(self, parent): wx.Frame.__init__(self, parent, title=u"My Frame") self.model = WatchableDict() self.model["text"] = "" sizer = wx.BoxSizer(wx.VERTICAL) self.text_ctrl = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0) sizer.Add(self.text_ctrl, 0, 0, 0) pywatch.wx.ValueChanger(self.text_ctrl, self.model, "text") self.static_text = wx.StaticText(self, wx.ID_ANY, u"Text: {0}", wx.DefaultPosition, wx.DefaultSize, 0) sizer.Add(self.static_text, 0, 0, 0) pywatch.wx.LabelWatcher(self.static_text, self.model, "text") self.SetSizer(sizer) self.Centre(wx.BOTH)
def __init__(self): wx.Frame.__init__(self, None, pos=wx.DefaultPosition, size=wx.Size(450, 100), style=wx.MINIMIZE_BOX | wx.SYSTEM_MENU | wx.CAPTION | wx.CLOSE_BOX | wx.CLIP_CHILDREN, title='KIARA') panel = wx.Panel(self) my_sizer = wx.BoxSizer(wx.VERTICAL) lbl = wx.StaticText(panel, label='''Hello I\'m Kiara the Python Digital Assistant. How can I help you?''') my_sizer.Add(lbl, 0, wx.ALL, 5) self.txt = wx.TextCtrl(panel, style=wx.TE_PROCESS_ENTER, size=(400, 30)) self.txt.SetFocus() self.txt.Bind(wx.EVT_TEXT_ENTER, self.OnEnter) my_sizer.Add(self.txt, 0, wx.ALL, 5) panel.SetSizer(my_sizer) self.Show() speak('Welcome my friend. I am Kiara. How can I help ?')
def button_clicked(self, event): log.debug("[Settings] Button clicked: {0}".format(IDS[event.GetId()])) button_id = event.GetId() keys = IDS[button_id].split(MODULE_KEY) last_key = keys[-1] if last_key in ['list_add', 'list_remove']: self.on_list_operation(MODULE_KEY.join(keys[:-1]), action=last_key) elif last_key in ['ok_button', 'apply_button']: if self.save_settings(): log.debug('Got non-dynamic changes') dialog = wx.MessageDialog(self, message=translate_key(MODULE_KEY.join(['main', 'save', 'non_dynamic'])), caption="Caption", style=wx.OK_DEFAULT, pos=wx.DefaultPosition) dialog.ShowModal() if last_key == 'ok_button': self.on_exit(event) self.settings_saved = True elif last_key == 'cancel_button': self.on_close(event) event.Skip()
def __init__( self, parent, id=-1, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.LC_REPORT|wx.LC_VIRTUAL|wx.LC_VRULES|wx.LC_SINGLE_SEL, validator=wx.DefaultValidator, columns=None, name=_("ProfileView"), ): wx.ListCtrl.__init__(self, parent, id, pos, size, style, validator, name) if columns is not None: self.columns = columns self.sortOrder = [ (self.columns[5].defaultOrder, self.columns[5]), ] self.sorted = [] self.CreateControls()
def __init__(self, parent=None, message='Message:', caption='Message', style=wx.OK|wx.CANCEL,pos=wx.DefaultPosition): wx.Dialog.__init__(self, parent, -1, caption, size=wx.DefaultSize, style=wx.CAPTION, pos=pos) self._build(message, style) self.Fit()
def __init__(self, master, SIMcontrol): self.parent = master self.SIM = SIMcontrol wxskinFrame.__init__(self, self.parent, -1, "Last Numbers", wx.DefaultPosition, (500, 400)) self.numberRecords = 0 self.abortedRead = 0 self.itemDataMap = {} self.createMenus() self.createWidgets()
def __init__(self, master, SIMcontrol, filepath): self.parent = master self.SIM = SIMcontrol self.filepath = filepath wxskinFrame.__init__(self, self.parent, -1, "Phonebook", wx.DefaultPosition, (500, 400)) self.numberRecords = 0 self.abortedRead = 0 self.itemDataMap = {} self.createMenus() self.createWidgets()
def OnInit(self): #print "hi!" frame = pySIM(None, -1, "pySIM", wx.DefaultPosition,(250,250) ) frame.Show(True) # self.setTopWindow(frame) return True ##################################################################################### #---------------------------------------------------------------------- #####################################################################################
def createLayout(self): self.listbox = wx.ListBox(self, ID_LISTBOX, wx.DefaultPosition, wx.DefaultSize, [], wx.LB_SINGLE | wx.LB_SORT, wx.DefaultValidator) self.listbox.typedText = "" s = "" try: if (os.name == "posix"): #s = "/dev/cu.PL2303-3B1\t" s = "/dev/ttyUSB0\t" if (os.name == "nt"): for i in range(1,10): s += "COM"+str(i)+"\t" except: print_exc() for i in s.split("\t"): if i: self.listbox.Append(i) self.bOK = wx.Button(self, ID_BUTTON_OK, "OK") self.bCancel = wx.Button(self, ID_BUTTON_CANCEL, "Cancel") self.sizer1 = wx.BoxSizer(wx.VERTICAL) self.sizer2 = wx.BoxSizer(wx.HORIZONTAL) self.sizer2.Add(self.bOK, 1, wx.EXPAND|wx.ALL,10) self.sizer2.Add(self.bCancel, 1, wx.EXPAND|wx.ALL,10) self.sizer1.Add(self.listbox, 1, wx.EXPAND|wx.ALL,20) self.sizer1.Add(self.sizer2) self.SetSizer(self.sizer1) self.SetAutoLayout(1) self.sizer1.Fit(self) wx.EVT_LISTBOX_DCLICK(self, ID_LISTBOX, self.selectNewReaderOK) wx.EVT_BUTTON(self, ID_BUTTON_OK, self.selectNewReaderOK) wx.EVT_BUTTON(self, ID_BUTTON_CANCEL, self.selectNewReaderCancel)
def createLayout(self): self.listbox = wx.ListBox(self, ID_LISTBOX, wx.DefaultPosition, wx.DefaultSize, [], wx.LB_SINGLE | wx.LB_SORT, wx.DefaultValidator) self.listbox.typedText = "" try: s = self.pcsc.listAllReaders() except: print_exc() for i in s.split("\t"): if i: self.listbox.Append(i) self.bOK = wx.Button(self, ID_BUTTON_OK, "OK") self.bCancel = wx.Button(self, ID_BUTTON_CANCEL, "Cancel") self.sizer1 = wx.BoxSizer(wx.VERTICAL) self.sizer2 = wx.BoxSizer(wx.HORIZONTAL) self.sizer2.Add(self.bOK, 1, wx.EXPAND|wx.ALL,10) self.sizer2.Add(self.bCancel, 1, wx.EXPAND|wx.ALL,10) self.sizer1.Add(self.listbox, 1, wx.EXPAND|wx.ALL,20) self.sizer1.Add(self.sizer2) self.SetSizer(self.sizer1) self.SetAutoLayout(1) self.sizer1.Fit(self) wx.EVT_LISTBOX_DCLICK(self, ID_LISTBOX, self.selectNewReaderOK) wx.EVT_BUTTON(self, ID_BUTTON_OK, self.selectNewReaderOK) wx.EVT_BUTTON(self, ID_BUTTON_CANCEL, self.selectNewReaderCancel)
def __init__(self, parent, ID=-1, title="Frame", pos=wx.DefaultPosition, size=wx.DefaultSize): wx.Frame.__init__(self, parent, ID, title, pos, size) self.SetBackgroundColour(backgroundColour) icon = wx.Icon('pySIM.ico', wx.BITMAP_TYPE_ICO) self.SetIcon(icon)
def __init__(self, parent, ID=-1, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.TAB_TRAVERSAL, name="panel"): wx.Panel.__init__(self, parent, ID, pos, size, style, name) self.SetBackgroundColour(backgroundColour)
def __init__(self, parent, id=-1, title="Dialog", pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.DEFAULT_DIALOG_STYLE): wx.Dialog.__init__(self, parent, id, title) self.SetBackgroundColour(backgroundColour)
def __init__(self, parent, ID=-1, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.LC_ICON): wx.ListCtrl.__init__(self, parent, ID, pos, size, style) self.SetBackgroundColour(backgroundColour)
def __init__(self, parent, messageString, titleString="pySIM", defaultValue='', style=wx.OK|wx.CANCEL|wx.CENTRE, pos=wx.DefaultPosition): wx.TextEntryDialog.__init__(self, parent, messageString, titleString, defaultValue, style, pos) self.SetBackgroundColour(backgroundColour) ################################################################################ # pySIM dialog helper classes # ################################################################################
def __init__(self, master, SIMcontrol): self.parent = master self.SIM = SIMcontrol wxskinFrame.__init__(self, self.parent, -1, "SMS Messages", wx.DefaultPosition, (500, 400)) self.numberRecords = 0 self.itemDataMap = {} self.phonebookMap = {} self.createMenus() self.createWidgets() self.createPhonebookMap()
def __init__( self, parent ): wx.Panel.__init__ ( self, parent, id = wx.ID_ANY, pos = wx.DefaultPosition, size = wx.Size( -1,-1 ), style = wx.TAB_TRAVERSAL ) bSizer111 = wx.BoxSizer( wx.VERTICAL ) self.m_textCtrlDocument = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( -1,-1 ), wx.TE_AUTO_URL|wx.TE_MULTILINE|wx.TE_READONLY ) bSizer111.Add( self.m_textCtrlDocument, 1, wx.ALIGN_CENTER_HORIZONTAL|wx.EXPAND, 5 ) self.SetSizer( bSizer111 ) self.Layout() bSizer111.Fit( self )
def __init__(self, parent, ID=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, style=0): wx.ListCtrl.__init__(self, parent, ID, pos, size, style) ########################################################################
def OnButton(self, evt): DrawFrame = BuildDrawFrame() frame = DrawFrame(None, -1, "FloatCanvas Drawing Window",wx.DefaultPosition,(500,500)) #win = wx.lib.plot.TestFrame(self, -1, "PlotCanvas Demo") frame.Show() frame.DrawTest()
def __init__(self, parent, dpi=None, **kwargs): wx.Panel.__init__(self, parent, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, **kwargs) self.ztv_frame = self.GetTopLevelParent() self.figure = Figure(dpi=None, figsize=(1.,1.)) self.axes = self.figure.add_subplot(111) self.canvas = FigureCanvasWxAgg(self, -1, self.figure) self.Bind(wx.EVT_SIZE, self._onSize)
def __init__(self, parent): wx.Panel.__init__(self, parent, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize) self.ztv_frame = self.GetTopLevelParent() self.ztv_frame.primary_image_panel.popup_menu_cursor_modes.append('Slice plot') self.ztv_frame.primary_image_panel.available_cursor_modes['Slice plot'] = { 'set-to-mode':self.set_cursor_to_plot_mode, 'on_button_press':self.on_button_press, 'on_motion':self.on_motion, 'on_button_release':self.on_button_release} for cur_key in ['c', 'C', 'v', 'V', 'y', 'Y']: self.ztv_frame.primary_image_panel.available_key_presses[cur_key] = self.do_column_plot for cur_key in ['r', 'R', 'h', 'H', 'x', 'X']: self.ztv_frame.primary_image_panel.available_key_presses[cur_key] = self.do_row_plot for cur_key in ['z', 'Z']: self.ztv_frame.primary_image_panel.available_key_presses[cur_key] = self.do_stack_plot self.primary_image_patch = None self.sizer = wx.BoxSizer(wx.VERTICAL) self.plot_panel = PlotPlotPanel(self) self.sizer.Add(self.plot_panel, 1, wx.LEFT | wx.TOP | wx.EXPAND) self.hideshow_button = wx.Button(self, wx.ID_ANY, u"Hide", wx.DefaultPosition, wx.DefaultSize, 0) self.sizer.Add(self.hideshow_button, 0, wx.ALL|wx.ALIGN_RIGHT|wx.ALIGN_BOTTOM, 2) self.hideshow_button.Bind(wx.EVT_BUTTON, self.on_hideshow_button) self.SetSizer(self.sizer) self.Fit() self.start_pt = wx.RealPoint(0., 0.) self.end_pt = wx.RealPoint(0., 0.) self.redraw() pub.subscribe(self.on_new_xy0, 'set-new-slice-plot-xy0') pub.subscribe(self.on_new_xy1, 'set-new-slice-plot-xy1') pub.subscribe(self.queue_redraw, 'primary-xy-limits-changed') pub.subscribe(self.queue_redraw, 'recalc-display-image-called') pub.subscribe(self.remove_overplot_on_image, 'hide-plot-panel-overplot') pub.subscribe(self.redraw_overplot_on_image, 'show-plot-panel-overplot') pub.subscribe(self.publish_xy0xy1_to_stream, 'get-slice-plot-coords')
def __init__(self, parent): wx.Notebook.__init__(self, parent, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, 0) self.highlight_char = unichr(0x2022) self._prior_notebook_page_change = (None, None) self.ztv_frame = self.GetTopLevelParent() self.ztv_frame.control_panels = [] # list of currently loaded/visible control panels, in order of display for cur_title, cur_panel in self.ztv_frame.control_panels_to_load: self.AddPanelAndStoreID(cur_panel(self), cur_title) self.ztv_frame.primary_image_panel.init_popup_menu()
def __init__(self, parent, dpi=None, **kwargs): wx.Panel.__init__(self, parent, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, **kwargs) self.ztv_frame = self.GetTopLevelParent() self.figure = Figure(dpi=None, figsize=(1.,1.)) self.axes = self.figure.add_subplot(111) self.canvas = FigureCanvasWxAgg(self, -1, self.figure) self.Bind(wx.EVT_SIZE, self._onSize) self.axes_widget = AxesWidget(self.figure.gca()) self.axes_widget.connect_event('motion_notify_event', self.on_motion) self.axes_widget.connect_event('button_press_event', self.on_button_press) self.axes_widget.connect_event('button_release_event', self.on_button_release) self.axes_widget.connect_event('figure_leave_event', self.on_cursor_leave) self.button_down = False
def __init__(self, parent, size=wx.Size(128,128), dpi=None, **kwargs): self.size = size self.size_npix_xy = wx.Size(11, 11) wx.Panel.__init__(self, parent, wx.ID_ANY, wx.DefaultPosition, size, 0, **kwargs) self.ztv_frame = self.GetTopLevelParent() self.figure = Figure(None, dpi) self.axes = self.figure.add_axes([0., 0., 1., 1.]) self.canvas = FigureCanvasWxAgg(self, -1, self.figure) self._SetSize() self.set_xy_limits() pub.subscribe(self.redraw_loupe_image, 'redraw-image')
def __init__(self, parent, ID, pos=wx.DefaultPosition, size=wx.DefaultSize, style=0): self.data = [] self.current_parrent = None dataview.DataViewListCtrl.__init__(self, parent, ID, pos, size, style) self.AppendBitmapColumn("", 0, width=20) self.AppendTextColumn("Name", 1, width=170) self.AppendTextColumn("Size", 2, width=170) self._SetBitmaps()
def __init__( self, parent ): wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = wx.EmptyString, pos = wx.DefaultPosition, size = wx.Size( 1200,800 ), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL ) self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize ) self.Layout() self.Centre( wx.BOTH )
def __init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.NO_BORDER): wx.Panel.__init__(self, parent, id=id, pos=pos, size=size, style=style) self.Viewport = wx.Panel(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.NO_BORDER) self.Scrollbar = wx.ScrollBar(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.SB_VERTICAL) sizer = wx.BoxSizer(wx.HORIZONTAL) sizer.Add(self.Viewport, 1, wx.EXPAND, 0) sizer.Add(self.Scrollbar, 0, wx.EXPAND, 0) self.SetSizer(sizer) self.Layout() sizer.Fit(self) self._presenter = Presenter.from_window(self.Viewport.GetHandle(), config.SCALE) self._graphics = None self._font = None self._entities = None self._selected_index = -1 self.Viewport.Bind(wx.EVT_PAINT, self.paint) self.Viewport.Bind(wx.EVT_SIZE, self.resize) self.Viewport.Bind(wx.EVT_MOUSEWHEEL, self.mouse_wheel) self.Viewport.Bind(wx.EVT_LEFT_DOWN, self.mouse_left_down) self.Scrollbar.Bind(wx.EVT_SCROLL, self.scroll)
def __init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.NO_BORDER): wx.Panel.__init__(self, parent, id=id, pos=pos, size=size, style=style) self.Viewport = wx.Panel(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.NO_BORDER) self.Scrollbar = wx.ScrollBar(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.SB_VERTICAL) sizer = wx.BoxSizer(wx.HORIZONTAL) sizer.Add(self.Viewport, 1, wx.EXPAND, 0) sizer.Add(self.Scrollbar, 0, wx.EXPAND, 0) self.SetSizer(sizer) self.Layout() sizer.Fit(self) self.Scrollbar.SetScrollbar(0, 0, 0, 0) self._presenter = Presenter.from_window(self.Viewport.GetHandle(), config.SCALE) self._camera = Camera(0, 0, 0, 0) self._tilemap = None self._tileset = None self._select_start = None self._select_end = None self._show_collision = False self.Viewport.Bind(wx.EVT_PAINT, self.paint) self.Viewport.Bind(wx.EVT_SIZE, self.resize) self.Viewport.Bind(wx.EVT_MOUSEWHEEL, self.mouse_wheel) self.Viewport.Bind(wx.EVT_LEFT_DOWN, self.mouse_left_down) self.Viewport.Bind(wx.EVT_LEFT_UP, self.mouse_left_up) self.Viewport.Bind(wx.EVT_MOTION, self.mouse_move) self.Scrollbar.Bind(wx.EVT_SCROLL, self.scroll)
def __init__(self, parent, id, name, pos=wx.DefaultPosition, size=wx.DefaultSize, style=0): wx.ListCtrl.__init__(self, parent, id, pos, size, style, name=name) listmix.ListCtrlAutoWidthMixin.__init__(self)
def __init__(self, parent, message, caption="Please enter text", defaultValue="", style=wx.OK | wx.CANCEL | wx.CENTRE, pos=wx.DefaultPosition): wx.TextEntryDialog.__init__(self, parent, message, caption, defaultValue, style, pos) self.PouNames = [] self.Bind(wx.EVT_BUTTON, self.OnOK, self.GetSizer().GetItem(2).GetSizer().GetItem(1).GetSizer().GetAffirmativeButton())
def __init__(self, parent, iec_type, defaultValue=""): wx.TextEntryDialog.__init__( self, parent, message=_("Forcing Variable Value"), caption=_("Please enter value for a \"%s\" variable:") % iec_type, defaultValue=defaultValue, style=wx.OK | wx.CANCEL | wx.CENTRE, pos=wx.DefaultPosition) self.IEC_Type = iec_type self.Bind(wx.EVT_BUTTON, self.OnOK, self.GetSizer().GetItem(2).GetSizer().GetItem(1). GetSizer().GetAffirmativeButton()) self.ValueTextCtrl = self.GetSizer().GetItem(1).GetWindow() if self.IEC_Type == "BOOL": self.ToggleButton = wx.ToggleButton(self, label=_("Toggle value")) value = GetTypeValue[self.IEC_Type](defaultValue) if value is not None: self.ToggleButton.SetValue(value) border = self.GetSizer().GetItem(1).GetBorder() self.GetSizer().Insert(before=2, item=self.ToggleButton, border=border, flag=wx.LEFT | wx.RIGHT | wx.EXPAND) self.Bind(wx.EVT_TOGGLEBUTTON, self.ToggleBoolValue, self.ToggleButton) self.Fit()
def __init__(self, parent, message, caption="Please enter text", defaultValue="", style=wx.OK | wx.CANCEL | wx.CENTRE, pos=wx.DefaultPosition): wx.TextEntryDialog.__init__(self, parent, message, caption, defaultValue, style, pos) self.PouNames = [] self.Variables = [] self.StepNames = [] self.Bind(wx.EVT_BUTTON, self.OnOK, self.GetSizer().GetItem(2).GetSizer().GetItem(1).GetSizer().GetAffirmativeButton())
def __init__(self, parent, ID, bitmapname, pos=wx.DefaultPosition, size=wx.DefaultSize, style=0, name="genstatbmp"): bitmap = GetBitmap(bitmapname) if bitmap is None: bitmap = wx.EmptyBitmap(0, 0) wx.StaticBitmap.__init__(self, parent, ID, bitmap, pos, size, style, name)
def __init__(self, parent, title='Frame3D', manager=None): wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = title, pos = wx.DefaultPosition, size = wx.Size( 800,600 ), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL ) self.SetSizeHints( wx.DefaultSize, wx.DefaultSize ) sizer = wx.BoxSizer( wx.VERTICAL ) root = os.path.abspath(os.path.dirname(__file__)) self.SetIcon(wx.Icon(os.path.join(root, 'imgs/logo.ico'), wx.BITMAP_TYPE_ICO)) self.viewer = canvas3d.Viewer3D( self , manager) sizer.Add( self.viewer, 1, wx.EXPAND |wx.ALL, 0 ) self.Bind(wx.EVT_CLOSE, self.on_closing) self.SetSizer( sizer ) self.Layout() self.Centre( wx.BOTH )
def __init__(self, parent ): wx.Panel.__init__ ( self, parent, id = wx.ID_ANY, pos = wx.DefaultPosition, size = wx.Size(256,81), style = wx.TAB_TRAVERSAL ) self.init_buf() self.his = None self.update = False self.x1, self.x2 = 0, 255 self.Bind(wx.EVT_SIZE, self.on_size) self.Bind(wx.EVT_IDLE, self.on_idle) self.Bind(wx.EVT_PAINT, self.on_paint)