我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用wx.ID_ANY。
def __init__(self, *args, **kwds): # begin wxGlade: Dialogo_acceso_vcenter.__init__ kwds["style"] = wx.DEFAULT_DIALOG_STYLE | wx.MAXIMIZE_BOX wx.Dialog.__init__(self, *args, **kwds) self.label_7 = wx.StaticText(self, wx.ID_ANY, "Vcenter / esxi:") self.nombre_vcenter = wx.TextCtrl(self, wx.ID_ANY, "") self.label_9 = wx.StaticText(self, wx.ID_ANY, "Login:") self.login_vcenter = wx.TextCtrl(self, wx.ID_ANY, "") self.label_10 = wx.StaticText(self, wx.ID_ANY, "Password:") self.passwor_vcenter = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_PASSWORD) self.label_8 = wx.StaticText(self, wx.ID_ANY, "Puerto:") self.puert_vcenter = wx.TextCtrl(self, wx.ID_ANY, "") self.button_Exit = wx.Button(self, wx.ID_CANCEL, "Exit") self.button_Connect = wx.Button(self, wx.ID_OK, "Conectar") self.__set_properties() self.__do_layout() # end wxGlade
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, parent, id, title): wx.Frame.__init__(self, parent, id, title, size=(400, 250)) panel = wx.Panel(self, wx.ID_ANY) panel.SetBackgroundColour('#000000') text = """\n \t \t \t E-Z Music Downloader v1.0 \n \n Type in the song you want to downloading the the first box like so: "Song name by Artist" make sure you have both the artist and the song name in the query, in the second box type in what you want to name the Mp3. Next select High quality or Medium quality. High quality creates a larger file, therefore takes longer to convert. The status bar will show the actions the program is doing, once the status bar says done you can download another. To change the directory in which the song downloads, go to options in the menu bar and select "ChangeDownloadDirectory". \n \n \t \t Thanks for chosing E-Z Musick Downloader! \n \n \t (Songs converted using http://www.convertmemp3.com )""" txt = wx.StaticText(panel, label=text) txt.SetForegroundColour('#FFFFFF') sizer = wx.BoxSizer(wx.HORIZONTAL) sizer.Add(txt, 1, wx.EXPAND|wx.ALIGN_CENTER, 5) panel.SetSizer(sizer) self.Show() self.Centre()
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, *args, **kwds): # begin wxGlade: Dialog_snapshot.__init__ kwds["style"] = wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER wx.Dialog.__init__(self, *args, **kwds) self.label_1 = wx.StaticText(self, wx.ID_ANY, "Nombre:") self.nombre_snap = wx.TextCtrl(self, wx.ID_ANY, "") self.label_2 = wx.StaticText(self, wx.ID_ANY, u"Descripci\u00f3n:") self.descripcion_snap = wx.TextCtrl(self, wx.ID_ANY, "") self.checkbox_memory = wx.CheckBox(self, wx.ID_ANY, "memory") self.checkbox_quiesce = wx.CheckBox(self, wx.ID_ANY, "quiesce") self.snap_ok = wx.Button(self, wx.ID_OK, "OK") self.snap_cancel = wx.Button(self, wx.ID_CANCEL, "Cancel") self.__set_properties() self.__do_layout() # end wxGlade
def __init__(self): wx.Frame.__init__(self, parent=None, id=wx.ID_ANY, title='Moogle HTTP to OPC Server', size=(800,600) ) sizer = wx.BoxSizer(wx.VERTICAL) self.row_colours = { 'rest': 'blue', 'opc': 'purple'} ## -- Configure Top Tool bar tb = wx.ToolBar(self, style=TBFLAGS) sizer.Add(tb, 0, wx.EXPAND) tsize = (24,24) tb.SetToolBitmapSize(tsize) tb.Realize() self.list = wx.ListCtrl(self, -1, style=wx.LC_REPORT #| wx.BORDER_SUNKEN #| wx.BORDER_NONE | wx.LC_EDIT_LABELS | wx.LC_SORT_ASCENDING | wx.LC_NO_HEADER | wx.LC_VRULES | wx.LC_HRULES #| wx.LC_SINGLE_SEL ) self.loadListviewHeader() sizer.Add(self.list, 1, wx.EXPAND) self.SetSizer(sizer) sizer.Layout() self.Bind(wx.EVT_CLOSE, self.onClose)
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 __init__(self, *args, **kwds): # begin wxGlade: LogicalVolumeDialog.__init__ wx.Dialog.__init__(self, *args, **kwds) self.panel_1 = wx.Panel(self, wx.ID_ANY) self.panel_4 = wx.Panel(self, wx.ID_ANY) self.label_1 = wx.StaticText(self, wx.ID_ANY, _("Select Logical Volume: "), style=wx.ALIGN_CENTER_HORIZONTAL) self.panel_7 = wx.Panel(self, wx.ID_ANY) self.combo_logical_volumes = wx.ComboBox(self, wx.ID_ANY, choices=[], style=wx.CB_DROPDOWN) self.panel_8 = wx.Panel(self, wx.ID_ANY) self.panel_3 = wx.Panel(self, wx.ID_ANY) self.panel_5 = wx.Panel(self, wx.ID_ANY) self.button_select = wx.Button(self, wx.ID_OK, _("Select")) self.panel_9 = wx.Panel(self, wx.ID_ANY) self.button_cancel = wx.Button(self, wx.ID_CANCEL, _("Cancel")) self.panel_6 = wx.Panel(self, wx.ID_ANY) self.panel_2 = wx.Panel(self, wx.ID_ANY) self.__set_properties() self.__do_layout() self.Bind(wx.EVT_BUTTON, self.button_select_click, id=wx.ID_OK) self.Bind(wx.EVT_BUTTON, self.button_cancel_click, id=wx.ID_CANCEL) # end wxGlade self.PopulateVolumes()
def __init__( self, parent ): win_height = parent.GetSize()[1] height_of_pannels_above = 230 space_left = win_height - height_of_pannels_above wx.Panel.__init__ ( self, parent, id = wx.ID_ANY, pos = (0, height_of_pannels_above), size = wx.Size(285, space_left), style = wx.TAB_TRAVERSAL ) # Start drawing the UI elements wx.StaticText(self, label='Pigrow Config', pos=(25, 10)) self.update_config_btn = wx.Button(self, label='read config from pigrow', pos=(15, 60), size=(175, 30)) self.update_config_btn.Bind(wx.EVT_BUTTON, self.update_config_click) self.name_box_btn = wx.Button(self, label='change box name', pos=(15, 95), size=(175, 30)) self.name_box_btn.Bind(wx.EVT_BUTTON, self.name_box_click) self.config_lamp_btn = wx.Button(self, label='config lamp', pos=(15, 130), size=(175, 30)) self.config_lamp_btn.Bind(wx.EVT_BUTTON, self.config_lamp_click) self.config_dht_btn = wx.Button(self, label='config dht', pos=(15, 165), size=(175, 30)) self.config_dht_btn.Bind(wx.EVT_BUTTON, self.config_dht_click) self.new_gpio_btn = wx.Button(self, label='Add new relay device', pos=(15, 200), size=(175, 30)) self.new_gpio_btn.Bind(wx.EVT_BUTTON, self.add_new_device_relay) self.update_settings_btn = wx.Button(self, label='update pigrow settings', pos=(15, 235), size=(175, 30)) self.update_settings_btn.Bind(wx.EVT_BUTTON, self.update_setting_click)
def __init__( self, parent ): win_height = parent.GetSize()[1] win_width = parent.GetSize()[0] w_space_left = win_width - 285 wx.Panel.__init__ ( self, parent, id = wx.ID_ANY, pos = (285, 0), size = wx.Size(w_space_left , 800), style = wx.TAB_TRAVERSAL ) ## Draw UI elements png = wx.Image('./config_info.png', wx.BITMAP_TYPE_ANY).ConvertToBitmap() wx.StaticBitmap(self, -1, png, (0, 0), (png.GetWidth(), png.GetHeight())) #SDcard details config_info_pnl.boxname_text = wx.TextCtrl(self, pos=(25, 150), size=(265,65)) config_info_pnl.location_text = wx.StaticText(self, label='locations', pos=(520, 120), size=(200,30)) config_info_pnl.config_text = wx.StaticText(self, label='config', pos=(520, 185), size=(200,30)) config_info_pnl.lamp_text = wx.StaticText(self, label='lamp', pos=(10, 330), size=(200,30)) config_info_pnl.dht_text = wx.StaticText(self, label='dht', pos=(10, 415), size=(200,30)) config_info_pnl.gpio_table = self.GPIO_list(self, 1) config_info_pnl.gpio_table.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.onDoubleClick_GPIO)
def __init__( self, parent ): win_height = parent.GetSize()[1] height_of_pannels_above = 230 space_left = win_height - height_of_pannels_above wx.Panel.__init__ ( self, parent, id = wx.ID_ANY, pos = (0, height_of_pannels_above), size = wx.Size(285, space_left), style = wx.TAB_TRAVERSAL ) wx.StaticText(self, label='Cron Config Menu', pos=(25, 10)) self.read_cron_btn = wx.Button(self, label='Read Crontab', pos=(10, 40), size=(175, 30)) self.read_cron_btn.Bind(wx.EVT_BUTTON, self.read_cron_click) self.new_cron_btn = wx.Button(self, label='New cron job', pos=(10, 80), size=(175, 30)) self.new_cron_btn.Bind(wx.EVT_BUTTON, self.new_cron_click) self.update_cron_btn = wx.Button(self, label='Update Cron', pos=(10, 120), size=(175, 30)) self.update_cron_btn.Bind(wx.EVT_BUTTON, self.update_cron_click) self.SetBackgroundColour('sea green') #TESTING ONLY REMOVE WHEN SIZING IS DONE AND ALL THAT BUSINESS bSizer = wx.BoxSizer(wx.VERTICAL) bSizer.Add(self.read_cron_btn, 0, wx.ALL, 5) bSizer.Add(self.new_cron_btn, 0, wx.ALL, 5) bSizer.Add(self.update_cron_btn, 0, wx.ALL, 5) self.SetSizer(bSizer)
def __init__( self, parent ): wx.Panel.__init__ ( self, parent, id = wx.ID_ANY, pos = (0,0), size = wx.Size( 285,190 ), style = wx.TAB_TRAVERSAL ) self.SetBackgroundColour((150,230,170)) #TESTING ONLY REMOVE WHEN SIZING IS DONE AND ALL THAT BUSINESS pi_link_pnl.target_ip = '' pi_link_pnl.target_user = '' pi_link_pnl.target_pass = '' pi_link_pnl.config_location_on_pi = '/home/pi/Pigrow/config/pigrow_config.txt' ## the three boxes for pi's connection details, IP, Username and Password self.l_ip = wx.StaticText(self, label='address', pos=(10, 20)) self.tb_ip = wx.TextCtrl(self, pos=(125, 25), size=(150, 25)) self.tb_ip.SetValue("192.168.1.") self.l_user = wx.StaticText(self, label='Username', pos=(10, 60)) self.tb_user = wx.TextCtrl(self, pos=(125, 60), size=(150, 25)) self.tb_user.SetValue("pi") self.l_pass = wx.StaticText(self, label='Password', pos=(10, 95)) self.tb_pass = wx.TextCtrl(self, pos=(125, 95), size=(150, 25)) self.tb_pass.SetValue("raspberry") ## link with pi button self.link_with_pi_btn = wx.Button(self, label='Link to Pi', pos=(10, 125), size=(175, 30)) self.link_with_pi_btn.Bind(wx.EVT_BUTTON, self.link_with_pi_btn_click) self.link_status_text = wx.StaticText(self, label='-- no link --', pos=(25, 160)) ## seek next pi button self.seek_for_pigrows_btn = wx.Button(self, label='Seek next', pos=(190,125)) self.seek_for_pigrows_btn.Bind(wx.EVT_BUTTON, self.seek_for_pigrows_click)
def __init__(self, parent, id=wx.ID_ANY, style=wx.ST_SIZEGRIP, name="EnhancedStatusBar"): """Default Class Constructor. EnhancedStatusBar.__init__(self, parent, id=wx.ID_ANY, style=wx.ST_SIZEGRIP, name="EnhancedStatusBar") """ wx.StatusBar.__init__(self, parent, id, style, name) self._items = {} self._curPos = 0 self._parent = parent wx.EVT_SIZE(self, self.OnSize) wx.CallAfter(self.OnSize, None)
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_txt(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 = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 ) 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 rgb(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 ) rgb = ['Red', 'Green', 'Blue'] for i in (0,1,2): histc = HistCanvas(panel) histc.set_hist(hist[i]) txt = wx.StaticText( panel, wx.ID_ANY, 'Channel:'+ rgb[i], 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[i], range(256))/hist[i].sum(), np.where(hist[i]>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 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): wx.Frame.__init__(self, None, wx.ID_ANY, "File and Folder Dialogs Tutorial") panel = wx.Panel(self, wx.ID_ANY) self.currentDirectory = os.getcwd() # create the buttons and bindings dirDlgBtn1 = wx.Button(panel, label="Choose Source") dirDlgBtn1.Bind(wx.EVT_BUTTON, self.onDir1) dirDlgBtn2 = wx.Button(panel, label="Choose Destination") dirDlgBtn2.Bind(wx.EVT_BUTTON, self.onDir2) moveBtn=wx.Button(panel, label="Check and Move Files") moveBtn.Bind(wx.EVT_BUTTON, self.moveUFiles) # put the buttons in a sizer sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(dirDlgBtn1, 0, wx.ALL|wx.CENTER, 5) sizer.Add(dirDlgBtn2, 0, wx.ALL|wx.CENTER, 5) sizer.Add(moveBtn, 0, wx.ALL|wx.CENTER, 5) panel.SetSizer(sizer)
def __init__(self, *args, **kwds): # begin wxGlade: disclaimer_win.__init__ kwds["style"] = wx.DEFAULT_FRAME_STYLE wx.Dialog.__init__(self, *args, **kwds) self.label_1 = wx.StaticText(self, wx.ID_ANY, ("Disclaimer")) self.text_ctrl_1 = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_MULTILINE | wx.TE_READONLY | wx.TE_WORDWRAP) self.button_disagree = wx.Button(self, wx.ID_ANY, ("Disagree")) self.button_agree = wx.Button(self, wx.ID_ANY, ("I agree")) self.text=''' This SOFTWARE PRODUCT is a an open source free software distributed with GPL 3 License. Your are free to modify it subject to the conditions laid in the license. It is also stated that the software is provided "as is" and "with all faults." THE developer makes no representations or warranties of any kind concerning the safety, suitability, lack of viruses, inaccuracies, typographical errors, or other harmful components of this SOFTWARE PRODUCT. There are inherent dangers in the use of any software, and you are solely responsible for determining whether this SOFTWARE PRODUCT is compatible with your equipment and and suits your needs. You are also solely responsible for the protection of your equipment and backup of your data, and THE PROVIDER will not be liable for any damages you may suffer in connection with using, modifying, or distributing this SOFTWARE PRODUCT.''' self.__set_properties() self.__do_layout() self.agree=False self.Bind(wx.EVT_BUTTON, self.on_disagree, self.button_disagree) self.Bind(wx.EVT_BUTTON, self.on_agree, self.button_agree) # end wxGlade
def __init__(self, *args, **kwds): # begin wxGlade: help_window.__init__ kwds["style"] = wx.MAXIMIZE | wx.CLOSE_BOX | wx.THICK_FRAME|wx.CAPTION wx.Dialog.__init__(self, *args, **kwds) self.window_1 = wx.SplitterWindow(self, wx.ID_ANY, style=wx.SP_3D | wx.SP_BORDER) self.window_1_pane_left = wx.Panel(self.window_1, wx.ID_ANY) self.html_left = html.HtmlWindow(self.window_1_pane_left, wx.ID_ANY, size=(1, 1)) self.window_1_pane_right = wx.Panel(self.window_1, wx.ID_ANY) self.html_right = html.HtmlWindow(self.window_1_pane_right, wx.ID_ANY, size=(1, 1)) #self.Bind(wx.EVT_COself.on_hyperlink,self.html_left) self.Bind(wx.html.EVT_HTML_LINK_CLICKED,self.on_hyperlink,self.html_left) #self.Bind(wx.EVT_SIZE,self.on_resize) self.__set_properties() self.__do_layout() #self.on_resize(None) self.load_htmlpage() # end wxGlade
def __init__(self, *args, **kwds): # begin wxGlade: MyDialog.__init__ #args[ kwds["style"] = wx.CAPTION | wx.CLOSE_BOX | wx.STAY_ON_TOP wx.Dialog.__init__(self, *args, **kwds) self.text_ctrl_passwd = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_PASSWORD) self.button_cancel = wx.Button(self, wx.ID_ANY, _("Cancel")) self.button_ok = wx.Button(self, wx.ID_ANY, _("OK")) self.__set_properties() self.__do_layout() self.password_text='' self.Bind(wx.EVT_TEXT, self.on_passwod, self.text_ctrl_passwd) self.Bind(wx.EVT_BUTTON, self.on_button_cancel, self.button_cancel) self.Bind(wx.EVT_BUTTON, self.on_button_ok, self.button_ok) self.cancelled=False # end wxGlade
def __init__(self, *args, **kwds): # begin wxGlade: add_academic_year.__init__ kwds["style"] = wx.DEFAULT_DIALOG_STYLE wx.Dialog.__init__(self, *args, **kwds) self.label_3 = wx.StaticText(self, wx.ID_ANY, ("Academic Year")) self.text_ctrl_1 = wx.TextCtrl(self, wx.ID_ANY, "") self.label_4 = wx.StaticText(self, wx.ID_ANY, ("-")) self.text_ctrl_2 = wx.TextCtrl(self, wx.ID_ANY, "") self.button_close = wx.Button(self, wx.ID_ANY, ("Close")) self.button_add = wx.Button(self, wx.ID_ANY, ("Add")) self.__set_properties() self.__do_layout() self.Bind(wx.EVT_TEXT, self.on_enter, self.text_ctrl_1) self.Bind(wx.EVT_BUTTON, self.on_close, self.button_close) self.Bind(wx.EVT_BUTTON, self.on_add, self.button_add) self.text_ctrl_1.Bind(wx.EVT_KEY_DOWN, self.handle_keypress) self.NEW_YEAR='' # end wxGlade
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, parent, id, title): wx.Dialog.__init__(self, parent, id, title) self.selection_idx = None self.selection_text = None vbox = wx.BoxSizer(wx.VERTICAL) stline = wx.StaticText( self, 11, 'Duplicate Component values found!' '\n\nPlease select which format to follow:') vbox.Add(stline, 0, wx.ALIGN_CENTER|wx.TOP) self.comp_list = wx.ListBox(self, 331, style=wx.LB_SINGLE) vbox.Add(self.comp_list, 1, wx.ALIGN_CENTER_HORIZONTAL | wx.EXPAND) self.SetSizer(vbox) self.comp_list.Bind(wx.EVT_LISTBOX_DCLICK, self.on_selection, id=wx.ID_ANY)
def __init__(self): wx.Frame.__init__(self, None, wx.ID_ANY, "Background Reset Tutorial") # Add a panel so it looks the correct on all platforms self.panel = wx.Panel(self, wx.ID_ANY) self.txt = wx.TextCtrl(self.panel) self.txt.SetBackgroundColour("Yellow") blueBtn = wx.Button(self.panel, label="Change Background Color") blueBtn.Bind(wx.EVT_BUTTON, self.onChangeBackground) resetBtn = wx.Button(self.panel, label="Reset") resetBtn.Bind(wx.EVT_BUTTON, self.onReset) topSizer = wx.BoxSizer(wx.VERTICAL) btnSizer = wx.BoxSizer(wx.HORIZONTAL) btnSizer.Add(blueBtn, 0, wx.ALL|wx.CENTER, 5) btnSizer.Add(resetBtn, 0, wx.ALL|wx.CENTER, 5) topSizer.Add(self.txt, 0, wx.ALL, 5) topSizer.Add(btnSizer, 0, wx.CENTER) self.panel.SetSizer(topSizer)
def __init__(self): wx.Frame.__init__(self, None, wx.ID_ANY, "Panel Switcher Tutorial") self.panel_one = PanelOne(self) self.panel_two = PanelTwo(self) self.panel_two.Hide() self.sizer = wx.BoxSizer(wx.VERTICAL) self.sizer.Add(self.panel_one, 1, wx.EXPAND) self.sizer.Add(self.panel_two, 1, wx.EXPAND) self.SetSizer(self.sizer) menubar = wx.MenuBar() fileMenu = wx.Menu() switch_panels_menu_item = fileMenu.Append( wx.ID_ANY, "Switch Panels", "Some text") self.Bind(wx.EVT_MENU, self.onSwitchPanels, switch_panels_menu_item) menubar.Append(fileMenu, '&File') self.SetMenuBar(menubar)
def __init__(self): wx.Frame.__init__(self, None, title="Tutorial") self.eventDict = {} evt_names = [x for x in dir(wx) if x.startswith("EVT_")] for name in evt_names: evt = getattr(wx, name) if isinstance(evt, wx.PyEventBinder): self.eventDict[evt.typeId] = name grid_evt_names = [x for x in dir(wx.grid) if x.startswith("EVT_")] for name in grid_evt_names: evt = getattr(wx.grid, name) if isinstance(evt, wx.PyEventBinder): self.eventDict[evt.typeId] = name panel = wx.Panel(self, wx.ID_ANY) btn = wx.Button(panel, wx.ID_ANY, "Get POS") btn.Bind(wx.EVT_BUTTON, self.onEvent) panel.Bind(wx.EVT_LEFT_DCLICK, self.onEvent) panel.Bind(wx.EVT_RIGHT_DOWN, self.onEvent)
def layout(self): """ Layout the widgets on the panel """ self.mainSizer = wx.BoxSizer(wx.VERTICAL) btnSizer = wx.BoxSizer(wx.HORIZONTAL) img = wx.EmptyImage(self.photoMaxSize,self.photoMaxSize) self.imageCtrl = wx.StaticBitmap(self, wx.ID_ANY, wx.BitmapFromImage(img)) self.mainSizer.Add(self.imageCtrl, 0, wx.ALL|wx.CENTER, 5) self.imageLabel = wx.StaticText(self, label="") self.mainSizer.Add(self.imageLabel, 0, wx.ALL|wx.CENTER, 5) btnData = [("Previous", btnSizer, self.onPrevious), ("Slide Show", btnSizer, self.onSlideShow), ("Next", btnSizer, self.onNext)] for data in btnData: label, sizer, handler = data self.btnBuilder(label, sizer, handler) self.mainSizer.Add(btnSizer, 0, wx.CENTER) self.SetSizer(self.mainSizer)
def __init__(self): wx.Frame.__init__(self, None, title="Timer Tutorial 2") panel = wx.Panel(self, wx.ID_ANY) self.timer = wx.Timer(self, id=TIMER_ID1) self.Bind(wx.EVT_TIMER, self.update, self.timer) self.timer2 = wx.Timer(self, id=TIMER_ID2) self.Bind(wx.EVT_TIMER, self.update, self.timer2) self.toggleBtn = wx.Button(panel, wx.ID_ANY, "Start Timer 1") self.toggleBtn.Bind(wx.EVT_BUTTON, self.onStartTimerOne) self.toggleBtn2 = wx.Button(panel, wx.ID_ANY, "Start Timer 2") self.toggleBtn2.Bind(wx.EVT_BUTTON, self.onStartTimerOne) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self.toggleBtn, 0, wx.ALL|wx.CENTER, 5) sizer.Add(self.toggleBtn2, 0, wx.ALL|wx.CENTER, 5) panel.SetSizer(sizer)
def __init__(self): wx.Frame.__init__(self, None, title="Timer Tutorial 2") panel = wx.Panel(self, wx.ID_ANY) self.timer = wx.Timer(self, wx.ID_ANY) self.Bind(wx.EVT_TIMER, self.update, self.timer) self.timer2 = wx.Timer(self, wx.ID_ANY) self.Bind(wx.EVT_TIMER, self.update, self.timer2) self.toggleBtn = wx.Button(panel, wx.ID_ANY, "Start Timer 1") self.toggleBtn.Bind(wx.EVT_BUTTON, self.onStartTimer) self.toggleBtn2 = wx.Button(panel, wx.ID_ANY, "Start Timer 2") self.toggleBtn2.Bind(wx.EVT_BUTTON, self.onStartTimer) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self.toggleBtn, 0, wx.ALL|wx.CENTER, 5) sizer.Add(self.toggleBtn2, 0, wx.ALL|wx.CENTER, 5) panel.SetSizer(sizer) # Each value in the following dict is formatted as follows: # (timerNum, timerObj, secs between timer events) self.objDict = {self.toggleBtn: (1, self.timer, 1000), self.toggleBtn2: (2, self.timer2, 3000)}
def __init__(self): wx.Frame.__init__(self, None, title="wxPython Redirect Tutorial") # Add a panel so it looks the correct on all platforms panel = wx.Panel(self, wx.ID_ANY) log = wx.TextCtrl(panel, wx.ID_ANY, size=(300,100), style = wx.TE_MULTILINE|wx.TE_READONLY|wx.HSCROLL) btn = wx.Button(panel, wx.ID_ANY, 'Push me!') self.Bind(wx.EVT_BUTTON, self.onButton, btn) # Add widgets to a sizer sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(log, 1, wx.ALL|wx.EXPAND, 5) sizer.Add(btn, 0, wx.ALL|wx.CENTER, 5) panel.SetSizer(sizer) # redirect text here redir = RedirectText(log) sys.stdout = redir
def __init__(self): wx.Frame.__init__(self, None, title="wxPython Redirect Tutorial") # Add a panel so it looks the correct on all platforms panel = wx.Panel(self, wx.ID_ANY) style = wx.TE_MULTILINE|wx.TE_READONLY|wx.HSCROLL log = wx.TextCtrl(panel, wx.ID_ANY, size=(300,100), style=style) btn = wx.Button(panel, wx.ID_ANY, 'Push me!') self.Bind(wx.EVT_BUTTON, self.onButton, btn) # Add widgets to a sizer sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(log, 1, wx.ALL|wx.EXPAND, 5) sizer.Add(btn, 0, wx.ALL|wx.CENTER, 5) panel.SetSizer(sizer) # redirect text here sys.stdout = log
def __init__(self): wx.Frame.__init__(self, None, wx.ID_ANY, 'My First Plot (to take over the world!)') # Add a panel so it looks the correct on all platforms panel = wx.Panel(self, wx.ID_ANY) # create some sizers mainSizer = wx.BoxSizer(wx.VERTICAL) checkSizer = wx.BoxSizer(wx.HORIZONTAL) # create the widgets self.canvas = PlotCanvas(panel) self.canvas.Draw(drawBarGraph()) toggleGrid = wx.CheckBox(panel, label="Show Grid") toggleGrid.Bind(wx.EVT_CHECKBOX, self.onToggleGrid) toggleLegend = wx.CheckBox(panel, label="Show Legend") toggleLegend.Bind(wx.EVT_CHECKBOX, self.onToggleLegend) # layout the widgets mainSizer.Add(self.canvas, 1, wx.EXPAND) checkSizer.Add(toggleGrid, 0, wx.ALL, 5) checkSizer.Add(toggleLegend, 0, wx.ALL, 5) mainSizer.Add(checkSizer) panel.SetSizer(mainSizer)
def __init__(self): wx.Frame.__init__(self, None, wx.ID_ANY, 'It Looks Like a Line Graph!') # Add a panel so it looks the correct on all platforms panel = wx.Panel(self, wx.ID_ANY) # create some sizers mainSizer = wx.BoxSizer(wx.VERTICAL) checkSizer = wx.BoxSizer(wx.HORIZONTAL) # create the widgets self.canvas = PlotCanvas(panel) self.canvas.Draw(drawLinePlot()) toggleGrid = wx.CheckBox(panel, label="Show Grid") toggleGrid.Bind(wx.EVT_CHECKBOX, self.onToggleGrid) toggleLegend = wx.CheckBox(panel, label="Show Legend") toggleLegend.Bind(wx.EVT_CHECKBOX, self.onToggleLegend) # layout the widgets mainSizer.Add(self.canvas, 1, wx.EXPAND) checkSizer.Add(toggleGrid, 0, wx.ALL, 5) checkSizer.Add(toggleLegend, 0, wx.ALL, 5) mainSizer.Add(checkSizer) panel.SetSizer(mainSizer)
def __init__(self): wx.Frame.__init__(self, None, wx.ID_ANY, 'Sin / Cos Plot') # Add a panel so it looks the correct on all platforms panel = wx.Panel(self, wx.ID_ANY) # create some sizers mainSizer = wx.BoxSizer(wx.VERTICAL) checkSizer = wx.BoxSizer(wx.HORIZONTAL) # create the widgets self.canvas = PlotCanvas(panel) self.canvas.Draw(drawSinCosWaves()) toggleGrid = wx.CheckBox(panel, label="Show Grid") toggleGrid.Bind(wx.EVT_CHECKBOX, self.onToggleGrid) toggleLegend = wx.CheckBox(panel, label="Show Legend") toggleLegend.Bind(wx.EVT_CHECKBOX, self.onToggleLegend) # layout the widgets mainSizer.Add(self.canvas, 1, wx.EXPAND) checkSizer.Add(toggleGrid, 0, wx.ALL, 5) checkSizer.Add(toggleLegend, 0, wx.ALL, 5) mainSizer.Add(checkSizer) panel.SetSizer(mainSizer)
def __init__(self, parent): wx.Frame.__init__(self, parent, wx.ID_ANY, title="About", size=(400,400)) html = wxHTML(self) html.SetPage( '' "<h2>About the About Tutorial</h2>" "<p>This about box is for demo purposes only. It was created in June 2006 " "by Mike Driscoll.</p>" "<p><b>Software used in making this demo:</h3></p>" '<p><b><a href="http://www.python.org">Python 2.7 / 3.5</a></b></p>' '<p><b><a href="http://www.wxpython.org">wxPython 3.0.2.0 / Phoenix</a></b></p>' )
def __init__(self, parent): wx.Frame.__init__(self, parent, wx.ID_ANY, title="About", size=(400,400)) html = wxHTML(self) html.SetPage( '' "<h2>About the About Tutorial</h2>" "<p>This about box is for demo purposes only. It was created in June 2006" "by Mike Driscoll.</p>" "<p><b>Software used in making this demo:</h3></p>" '<p><b><a href="http://www.python.org">Python 2.4</a></b></p>' '<p><b><a href="http://www.wxpython.org">wxPython 2.8</a></b></p>' )
def __init__(self): wx.Frame.__init__(self, None, title="Tutorial") panel = wx.Panel(self, wx.ID_ANY) cars = [Car(0, "Ford", "F-150", "2008"), Car(1, "Chevrolet", "Camaro", "2010"), Car(2, "Nissan", "370Z", "2005")] sampleList = [] self.cb = wx.ComboBox(panel, size=wx.DefaultSize, choices=sampleList) self.widgetMaker(self.cb, cars) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self.cb, 0, wx.ALL, 5) panel.SetSizer(sizer)
def __init__(self): wx.Frame.__init__(self, None, title="ListBox Obj Tutorial") panel = wx.Panel(self, wx.ID_ANY) ford = Car(0, "Ford", "F-150", "2008") chevy = Car(1, "Chevrolet", "Camaro", "2010") nissan = Car(2, "Nissan", "370Z", "2005") sampleList = [] lb = wx.ListBox(panel, size=wx.DefaultSize, choices=sampleList) self.lb = lb lb.Append(ford.make, ford) lb.Append(chevy.make, chevy) lb.Append(nissan.make, nissan) lb.Bind(wx.EVT_LISTBOX, self.onSelect) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(lb, 0, wx.ALL, 5) panel.SetSizer(sizer)
def __init__(self): super(SignalKScope, self).__init__(None) self.plot = SignalKPlot() self.glContext = wx.glcanvas.GLContext(self.glArea) self.client = SignalKClientFromArgs(sys.argv[:2], True, self.on_con) self.host_port = self.client.host_port self.client.autoreconnect = False self.value_list = self.client.list_values() self.plot.init(self.value_list) self.watches = {} watches = sys.argv[2:] for name in sorted(self.value_list): if self.value_list[name]['type'] != 'SensorValue': continue i = self.clValues.Append(name) self.watches[name] = False for arg in watches: if arg == name: self.clValues.Check(i, True) self.watches[name] = True watches.remove(name) for arg in watches: print 'value not found:', arg self.on_con(self.client) self.timer = wx.Timer(self, wx.ID_ANY) self.Bind(wx.EVT_TIMER, self.receive_messages, id=wx.ID_ANY) self.timer.Start(100) self.sTime.SetValue(self.plot.disptime) self.plot_reshape = False
def InitUI(self,config=None): artprovider = wx.ArtProvider() toolbar = self.CreateToolBar(style=wx.TB_TEXT|wx.TB_HORZ_LAYOUT) toolOpen = toolbar.AddTool(wx.ID_ANY, 'Open', artprovider.GetBitmap(wx.ART_FILE_OPEN,client=wx.ART_TOOLBAR),"Open an i3 config file") toolSave = toolbar.AddTool(wx.ID_ANY, 'Save', artprovider.GetBitmap(wx.ART_FILE_SAVE,client=wx.ART_TOOLBAR),"Save the current settings to the open file") toolApply = toolbar.AddTool(wx.ID_ANY, 'Apply', artprovider.GetBitmap(wx.ART_TICK_MARK,client=wx.ART_TOOLBAR),"Apply the changes without changing file") toolUpdateLocal = toolbar.AddTool(wx.ID_ANY, 'Save to config', artprovider.GetBitmap(wx.ART_FILE_SAVE_AS,client=wx.ART_TOOLBAR),"Save the current colour scheme into your current config") toolSnippet = toolbar.AddTool(wx.ID_ANY, 'Create colour snippet', artprovider.GetBitmap(wx.ART_NEW,client=wx.ART_TOOLBAR),"Save the current colour scheme as a standalone colour file you can send to others") toolVariable = toolbar.AddTool(wx.ID_ANY, 'Create colour variable', artprovider.GetBitmap(wx.ART_PLUS,client=wx.ART_TOOLBAR),"Create a new colour variable") toolbar.AddStretchableSpace() toolQuit = toolbar.AddTool(wx.ID_ANY, 'Quit', artprovider.GetBitmap(wx.ART_QUIT,client=wx.ART_TOOLBAR),"Quit the program") self.Bind(wx.EVT_TOOL, self.OnQuit,toolQuit) self.Bind(wx.EVT_TOOL, self.OnOpen,toolOpen) self.Bind(wx.EVT_TOOL, self.OnApply,toolApply) self.Bind(wx.EVT_TOOL, self.OnSave,toolSave) self.Bind(wx.EVT_TOOL, self.OnUpdateLocal,toolUpdateLocal) self.Bind(wx.EVT_TOOL, self.OnCreateSnippet,toolSnippet) self.Bind(wx.EVT_TOOL, self.OnCreateVariable,toolVariable) self.scrolled = wx.lib.scrolledpanel.ScrolledPanel(self,-1) self.scrolled.SetupScrolling() self.scrolled.Show() self.Centre() self.Show(True) if config!=None: self.LoadConfig(config)
def __init__(self, parent): wx.Dialog.__init__(self, parent, wx.ID_ANY, "About NodeMCU PyFlasher") html = HtmlWindow(self, wx.ID_ANY, size=(420, -1)) if "gtk2" in wx.PlatformInfo or "gtk3" in wx.PlatformInfo: html.SetStandardFonts() txt = self.text.format(self._get_bundle_dir(), __version__) html.SetPage(txt) ir = html.GetInternalRepresentation() html.SetSize((ir.GetWidth() + 25, ir.GetHeight() + 25)) self.SetClientSize(html.GetSize()) self.CentreOnParent(wx.BOTH)
def __init__(self, parent, style, html_body_content, bgcolor, size): wx.PopupTransientWindow.__init__(self, parent, style) panel = wx.Panel(self) panel.SetBackgroundColour(bgcolor) html_window = self.HtmlWindow(panel, wx.ID_ANY, size=size) html_window.SetPage('<body bgcolor="' + bgcolor + '">' + html_body_content + '</body>') sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(html_window, 0, wx.ALL, 5) panel.SetSizer(sizer) sizer.Fit(panel) sizer.Fit(self) self.Layout()
def __init__(self, title, pos, size): # Initialize some flags self.IsEtotRead = False wx.Frame.__init__(self, None, -1, title, pos, size) panel = wx.Panel(self, -1) panel.SetBackgroundColour("White") text = wx.TextCtrl(self, wx.ID_ANY, size=size, style = wx.TE_MULTILINE|wx.TE_READONLY|wx.HSCROLL) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(text, 1, wx.EXPAND) self.SetSizer(sizer) self.Fit() self.Bind(wx.EVT_CLOSE, self.OnQuit) self.createMenuBar() self.CreateStatusBar() self.SetStatusText("Welcome to pyQHA") # Redirect stout to the TextCtrl in the main panel self.redir=RedirectText(text) sys.stdout=self.redir sys.stderr=self.redir ############################################################################ # # Menu functions #
def __init__(self, parent, columns, df_list_ctrl, change_callback): wx.Panel.__init__(self, parent) columns_with_neutral_selection = [''] + list(columns) self.columns = columns self.df_list_ctrl = df_list_ctrl self.change_callback = change_callback self.num_filters = 10 self.main_sizer = wx.BoxSizer(wx.VERTICAL) self.combo_boxes = [] self.text_controls = [] for i in range(self.num_filters): combo_box = wx.ComboBox(self, choices=columns_with_neutral_selection, style=wx.CB_READONLY) text_ctrl = wx.TextCtrl(self, wx.ID_ANY, '') self.Bind(wx.EVT_COMBOBOX, self.on_combo_box_select) self.Bind(wx.EVT_TEXT, self.on_text_change) row_sizer = wx.BoxSizer(wx.HORIZONTAL) row_sizer.Add(combo_box, 0, wx.ALL, 5) row_sizer.Add(text_ctrl, 1, wx.ALL | wx.EXPAND | wx.ALIGN_RIGHT, 5) self.combo_boxes.append(combo_box) self.text_controls.append(text_ctrl) self.main_sizer.Add(row_sizer, 0, wx.EXPAND) self.SetSizer(self.main_sizer)
def CreateMenuBar(self): menubar = wx.MenuBar() fileMenu = wx.Menu() nitem = fileMenu.Append(wx.ID_NEW, '&New', 'New project' ) oitem = fileMenu.Append(wx.ID_OPEN, '&Open', 'Open project') self.ritem = fileMenu.Append(wx.ID_SAVEAS, '&Render\tCtrl-r', 'Render') self.iitem = fileMenu.Append(wx.ID_ANY, '&Import\tCtrl-i', 'Import image directory') self.qitem = fileMenu.Append(wx.ID_EXIT, '&Quit', 'Quit application') editMenu = wx.Menu() self.zitem = editMenu.Append(wx.ID_UNDO, '&Undo\tCtrl-z', 'Undo Delete') #yitem = editMenu.Append(wx.ID_REDO, '&Redo', 'Redo') self.ditem = editMenu.Append(wx.ID_DELETE, '&Delete\tDelete', 'Delete') pitem = editMenu.Append(wx.ID_PREFERENCES, '&Preferences\tCtrl-,', 'Preferences') helpMenu = wx.Menu() aitem = helpMenu.Append(wx.ID_ABOUT, '&About\tCtrl-?', 'About Stopgo') menubar.Append(fileMenu, '&File') menubar.Append(editMenu, '&Edit') menubar.Append(helpMenu, '&Help') self.Bind(wx.EVT_MENU, lambda event, args=(False): self.OpenFile(event,args), oitem) self.Bind(wx.EVT_MENU, self.NewFile, nitem) self.Bind(wx.EVT_MENU, self.Pref, pitem) self.Bind(wx.EVT_MENU, lambda event,args=(False): ingest.Ingest(self),self.iitem) self.Bind(wx.EVT_MENU, self.SimpleQuit, self.qitem) self.Bind(wx.EVT_CLOSE, self.SimpleQuit, self.qitem) self.Bind(wx.EVT_MENU, self.About, aitem) self.SetMenuBar(menubar)
def BuildTimeline(self,dbfile): for child in self.panel3.GetChildren(): logging.exception(child) child.Destroy() # the last frame is latestfram = self.cur.execute("SELECT * FROM Timeline ORDER BY Image DESC LIMIT 1") #latestfram = self.cur.execute("SELECT * FROM Timeline WHERE ID = (SELECT MAX(ID) FROM TABLE) AND Blackspot = 0"); try: for entry in latestfram: self.framlog = int(entry[1].split('.')[0]) self.framlog += 1 logging.exception(self.framlog) except: logging.exception('Looking for last frame but did not find.') pass # timeline contains tbl_timeline = self.cur.execute("SELECT * FROM Timeline WHERE Blackspot=0") for entry in tbl_timeline: img = self.MakeThumbnail(os.path.join(self.imgdir, entry[1]), self.thumbsize) self.imageCtrl = wx.StaticBitmap(self.panel3, wx.ID_ANY, wx.BitmapFromImage(img),name=entry[1]) self.imageCtrl.SetBitmap(wx.BitmapFromImage(img)) self.imageCtrl.Bind( wx.EVT_LEFT_DOWN, self.OnLeftClick ) self.imageCtrl.Bind( wx.EVT_LEFT_UP, self.OnLeftRelease ) logging.exception(self.imageCtrl.GetId() ) self.hbox2.Add( self.imageCtrl, 0, wx.ALL, 5 ) self.Layout() self.panel3.SetFocus() self.BindKeys(dbfile) self.hbox2.Layout() self.panel3.Refresh() self.panel3.Update() self.Refresh()