我们从Python开源项目中,提取了以下34个代码示例,用于说明如何使用wx.Icon()。
def __init__(self, parent): super(MyFrame, self).__init__(parent, title=TITLE, size=(1280, 768)) icon_path = 'Assets/Microsoft-logo_rgb_c-gray.png' self.SetIcon(wx.Icon(icon_path)) sizer = wx.BoxSizer(wx.VERTICAL) self.title = MyTitle(self) sizer.Add(self.title, flag=wx.EXPAND) self.book = MyLabelBook(self) sizer.Add(self.book, 1, flag=wx.EXPAND) status_text = ( 'Microsoft will receive the images you upload and may use them to ' 'improve Face API and related services. By submitting an image, ' 'you confirm you have consent from everyone in it.' ) self.status = wx.StatusBar(self) self.status.SetStatusText(status_text) sizer.Add(self.status, flag=wx.EXPAND) self.SetSizer(sizer) self.Layout()
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 LoadIconList(self): isz = (16, 16) self.tree_fs.icon_list = wx.ImageList(*isz) folder = wx.Icon( 'icons/ic_folder_black_18dp.png', wx.BITMAP_TYPE_PNG, isz[0], isz[1], ) folder_open = wx.Icon( 'icons/ic_folder_open_black_18dp.png', wx.BITMAP_TYPE_PNG, isz[0], isz[1], ) self.tree_fs.icon_fldridx = self.tree_fs.icon_list.AddIcon(folder) self.tree_fs.icon_fldropenidx = self.tree_fs.icon_list.AddIcon(folder_open) self.tree_fs.icon_fileidx = self.tree_fs.icon_list.AddIcon(wx.ArtProvider.GetIcon(wx.ART_NORMAL_FILE, wx.ART_OTHER, isz)) self.tree_fs.SetImageList(self.tree_fs.icon_list)
def __init__(self, controller_uid): TopLevel.__init__(self, controller_uid) UIM = UIManager() controller = UIM.get(self._controller_uid) wx.Dialog.__init__(self, None, wx.ID_ANY, controller.model.title, pos=controller.model.pos, size=controller.model.size, style=controller.model.style ) self._objects = {} if controller.model.icon: self.icon = wx.Icon(controller.model.icon, wx.BITMAP_TYPE_ICO) self.SetIcon(self.icon) if controller.model.maximized: self.Maximize() self.Bind(wx.EVT_MAXIMIZE, self.on_maximize) self.Bind(wx.EVT_SIZE, self.on_size) self.Bind(wx.EVT_MOVE, self.on_move) dialog_box = wx.BoxSizer(wx.VERTICAL) self.SetSizer(dialog_box) self.mainpanel = self.AddCreateContainer('BoxSizer', self, proportion=1, flag=wx.TOP|wx.LEFT|wx.RIGHT|wx.EXPAND, border=10 ) button_sizer = self.CreateButtonSizer(controller.model.flags) dialog_box.Add(button_sizer, flag=wx.ALIGN_CENTER|wx.TOP|wx.BOTTOM, border=10) dialog_box.Layout()
def __init__(self, *args, **kwargs): if 'size' not in kwargs: kwargs['size'] = (360, 240) super(NewRockTableDialog, self).__init__(*args, **kwargs) # ico = wx.Icon(r'./icons/plus32x32.ico', wx.BITMAP_TYPE_ICO) # self.SetIcon(ico) fgs = wx.BoxSizer(wx.HORIZONTAL) main_label = wx.StaticText(self, label="Fill up the cell below to create a new rock table.") name_label = wx.StaticText(self, label="Name Rock Table: ") # unit_label = wx.StaticText(self, label="Unidade: ") self.name_ctrl = wx.TextCtrl(self) # self.unit_ctrl = wx.TextCtrl(self) fgs.Add(name_label, 0, wx.EXPAND) fgs.Add(self.name_ctrl, 1, wx.EXPAND) # fgs.AddGrowableRow(0) sizer = wx.BoxSizer(wx.VERTICAL) button_sizer = self.CreateButtonSizer(wx.OK | wx.CANCEL) sizer.Add(main_label, 1, wx.GROW | wx.EXPAND) sizer.Add(fgs, 0, wx.EXPAND) sizer.Add(button_sizer, 0, wx.EXPAND) self.SetSizer(sizer) self.name_ctrl.SetFocus()
def OnAboutBox(self): description = """StopGo helps you create stop motion animation.""" licence = """StopGo is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. StopGo is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with File Hunter; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA VERSION_STRIVERSION_STRIVERSION_STRINVERSION_STRING307 USA""" info = wx.AboutDialogInfo() info.SetIcon(wx.Icon(os.path.join(os.path.dirname(__file__),'..','..','stopgo','images','makerbox.png'), wx.BITMAP_TYPE_PNG)) info.SetName('StopGo') info.SetVersion('0.8.18') info.SetDescription(description) info.SetCopyright('(C) 2016 - ' + str(date.today().year) + ' Seth Kenlon') info.SetWebSite('http://makerbox.org.nz') info.SetLicence(licence) info.AddDeveloper('Klaatu, Seth Kenlon, Jess Weichler') wx.AboutBox(info)
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, title): style = wx.DEFAULT_FRAME_STYLE & ~( wx.RESIZE_BORDER | wx.MAXIMIZE_BOX | wx.MINIMIZE_BOX|wx.CLOSE_BOX) wx.Frame.__init__(self, parent, title=title, style=style, size=(400,60)) self.textbox = wx.TextCtrl(self) img = wx.Image("matags.png", wx.BITMAP_TYPE_ANY) bmp = wx.Bitmap(img) self.icon = wx.Icon() self.icon.CopyFromBitmap(bmp) self.SetIcon(self.icon) self.tbIcon = wx.adv.TaskBarIcon() self.tbIcon.SetIcon(self.icon) self.Show(True) self.Centre() self.reg_hot_keys() self.Bind(wx.EVT_HOTKEY, self.on_extract_tag, id=self.hotkeys['extract_tag'][0]) self.Bind(wx.EVT_HOTKEY, self.on_close, id=self.hotkeys['quit'][0]) self.Bind(wx.EVT_HOTKEY, self.on_activate, id=self.hotkeys['activate'][0]) self.Bind(wx.EVT_HOTKEY, self.on_refresh, id=self.hotkeys['refresh'][0]) self.textbox.Bind(wx.EVT_CHAR, self.check_key) # do not use EVT_KEY_DOWN, # it becomes difficult to get lower case # self.textbox.Bind(wx.EVT_KEY_DOWN, self.check_key) # self.Bind(wx.EVT_CLOSE, self.on_close) self.Bind(wx.EVT_ICONIZE, self.on_iconify) self.matags = MaTags() # try: # except Exception as e: # self.textbox.ChangeValue(e.args[0].decode('utf8', 'ignore')) # self.textbox.Disable()
def __init__(self, parent, title): self.dirname=os.getcwd() wx.Frame.__init__(self, parent, title=title, size=(1000,700)) self.SetSizeHints(1000,700,-1,-1) self.CreateStatusBar() filemenu= wx.Menu() menuOpen = filemenu.Append(wx.ID_OPEN, "&Open"," Open saved state") menuSave = filemenu.Append(wx.ID_SAVE, "&Save"," Save current state") filemenu.InsertSeparator(2) menuNew = filemenu.Append(wx.ID_NEW, "&New"," Create new session") filemenu.InsertSeparator(4) menuExit = filemenu.Append(wx.ID_EXIT,"E&xit"," Terminate the program") viewmenu = wx.Menu() vismenu = wx.Menu() self.viewmenuundock = vismenu.Append(wx.ID_ANY,"&Undock","Undock the visualisation") self.viewmenuundock.Enable(0) self.viewmenudock = vismenu.Append(wx.ID_ANY,"&Dock","Dock the visualisation") self.viewmenudock.Enable(0) self.Bind(wx.EVT_MENU, self.OnUndock, self.viewmenuundock) self.Bind(wx.EVT_MENU, self.OnDock, self.viewmenudock) if IsNotWX4(): viewmenu.AppendMenu(wx.ID_ANY,"&Visualisation", vismenu) else: viewmenu.Append(wx.ID_ANY,"&Visualisation", vismenu) self.visualdialog_docked = True editmenu = wx.Menu() self.menuCWD = editmenu.Append(wx.ID_ANY, "Current Working &Directory","Current Working Directory") self.Bind(wx.EVT_MENU, self.OnCWD, self.menuCWD) helpmenu= wx.Menu() menuAbout= helpmenu.Append(wx.ID_ABOUT, "&About"," Information about Bonsu") menuDoc= helpmenu.Append(wx.ID_HELP, "&Contents","Documentation") menuBar = wx.MenuBar() menuBar.Append(filemenu,"&File") menuBar.Append(viewmenu,"&View") menuBar.Append(editmenu,"&Edit") menuBar.Append(helpmenu,"&Help") self.SetMenuBar(menuBar) self.Bind(wx.EVT_MENU, self.OnOpen, menuOpen) self.Bind(wx.EVT_MENU, self.OnSave, menuSave) self.Bind(wx.EVT_MENU, self.OnNew, menuNew) self.Bind(wx.EVT_MENU, self.OnExit, menuExit) self.Bind(wx.EVT_MENU, self.OnAbout, menuAbout) self.Bind(wx.EVT_MENU, self.OnHelp, menuDoc) self.Bind(wx.EVT_CLOSE, self.OnExit) self.fontpointsize=wx.SystemSettings.GetFont(wx.SYS_SYSTEM_FONT).GetPointSize() self.font = wx.Font(self.fontpointsize, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL) self.SetFont(self.font) icon = wx.Icon(os.path.join(os.path.dirname(os.path.dirname(__file__)), 'image', 'bonsu.ico'), wx.BITMAP_TYPE_ICO) wx.Frame.SetIcon(self, icon) self.nb = None self.sizer = wx.BoxSizer(wx.VERTICAL) self.Fit() self.Layout() self.Show()
def setIcon(self): #???? icon = wx.Icon("icon.ico",wx.BITMAP_TYPE_ICO) self.SetIcon(icon)
def __init__(self, parent, fileOpen=None): """ Constructor of the PLCOpenEditor class. :param parent: The parent window. :param fileOpen: The filepath to open if no controler defined (default: None). """ self.icon = wx.Icon(os.path.join(beremiz_dir, "images", "poe.ico"), wx.BITMAP_TYPE_ICO) IDEFrame.__init__(self, parent) result = None # Open the filepath if defined if fileOpen is not None: fileOpen = DecodeFileSystemPath(fileOpen, False) if os.path.isfile(fileOpen): # Create a new controller controler = PLCControler() result = controler.OpenXMLFile(fileOpen) self.Controler = controler self.LibraryPanel.SetController(controler) self.ProjectTree.Enable(True) self.PouInstanceVariablesPanel.SetController(controler) self._Refresh(PROJECTTREE, POUINSTANCEVARIABLESPANEL, LIBRARYTREE) # Define PLCOpenEditor icon self.SetIcon(self.icon) self.Bind(wx.EVT_CLOSE, self.OnCloseFrame) self._Refresh(TITLE, EDITORTOOLBAR, FILEMENU, EDITMENU, DISPLAYMENU) if result is not None: (num, line) = result self.ShowErrorMessage(_("PLC syntax error at line {a1}:\n{a2}").format(a1=num, a2=line))
def OnAboutMenu(self, event): info = version.GetAboutDialogInfo() info.Name = "PLCOpenEditor" info.Description = _("PLCOpenEditor is part of Beremiz project.\n\n" "Beremiz is an ") + info.Description info.Icon = wx.Icon(os.path.join(beremiz_dir, "images", "aboutlogo.png"), wx.BITMAP_TYPE_PNG) ShowAboutDialog(self, info)
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, title, data, cols=None, rows=None): wx.Frame.__init__(self, parent, -1, title) logopath = os.path.join(root_dir, 'data/logo.ico') self.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_3DLIGHT ) ) self.SetIcon(wx.Icon(logopath, wx.BITMAP_TYPE_ICO)) TableLogManager.add(title, self) self.data, self.cols, self.rows = data, cols, rows tableBase = GenericTable(data, cols, rows) self.grid = wx.grid.Grid(self) ## create tablegrid and set tablegrid value #self.grid.SetTable(tableBase) self.Bind(wx.EVT_CLOSE, self.OnClose) self.grid.CreateGrid(len(data), len(data[0])) if cols!=None: for i in range(len(cols)): self.grid.SetColLabelValue(i, cols[i]) if rows!=None: for i in range(len(rows)): self.grid.SetColLabelValue(i, rows[i]) for i in range(len(data)): for j in range(len(data[0])): self.grid.SetCellValue(i, j,str(data[i][j])) self.grid.AutoSize() ## create menus menus = [('File(&F)', [('Save as tab', self.OnSaveTab), ('Save as csv', self.OnSaveCsv), ('-'), ('Exit', self.OnClose) ] ), ('Help(&H)', [('About', self.OnAbout)] ) ] ## bind the menus with the correspond events menuBar=wx.MenuBar() for menu in menus: m = wx.Menu() for item in menu[1]: if item[0]=='-': m.AppendSeparator() else: i = m.Append(-1, item[0]) if item[1]!=None: self.Bind(wx.EVT_MENU,item[1], i) menuBar.Append(m,menu[0]) self.SetMenuBar(menuBar) self.Fit()
def __init__(self, parent, title, cont, url): wx.Frame.__init__ (self, parent, id = wx.ID_ANY, title = title, size = wx.Size(500,500)) logopath = os.path.join(root_dir, 'data/logo.ico') self.SetIcon(wx.Icon(logopath, wx.BITMAP_TYPE_ICO)) HtmlPanel(self, md2html(cont), url)
def __init__(self, title='ImagePy TexLog'): wx.Frame.__init__(self, IPy.curapp,title=title,size=(500,300)) logopath = os.path.join(root_dir, 'data/logo.ico') self.SetIcon(wx.Icon(logopath, wx.BITMAP_TYPE_ICO)) self.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_3DLIGHT ) ) self.title = title TextLogManager.add(title, self) self.file='' ### Create menus (name:event) k-v pairs menus = [ ## File ('File(&F)',[('Open', self.OnOpen), ('Save', self.OnSave), ('Save as', self.OnSaveAs), ('-'), ('Exit', self.OnClose) ]), ## Edit ('Edit(&E)', [ ('Undo', self.OnUndo), ('Redo', self.OnRedo), ('-'), ('Cut', self.OnCut), ('Copy', self.OnCopy), ('Paste', self.OnPaste), ('-'), ('All', self.OnSelectAll) ]), ## Help ('Help(&H)', [('About', self.OnAbout)]) ] ### Bind menus with the corresponding events self.menuBar=wx.MenuBar() for menu in menus: m = wx.Menu() for item in menu[1]: if item[0]=='-': m.AppendSeparator() else: i = m.Append(-1, item[0]) self.Bind(wx.EVT_MENU,item[1], i) self.menuBar.Append(m,menu[0]) self.SetMenuBar(self.menuBar) self.Bind(wx.EVT_CLOSE, self.OnClosing) sizer = wx.BoxSizer( wx.VERTICAL ) self.text= wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.TE_MULTILINE ) sizer.Add( self.text, 1, wx.ALL|wx.EXPAND, 1 ) self.SetSizer( sizer ) self.Bind(wx.EVT_RIGHT_DOWN,self.OnRClick)
def __init__( self, parent, title): wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = title, pos = wx.DefaultPosition, size = wx.Size( 500,300 ) ) logopath = os.path.join(root_dir, 'data/logo.ico') self.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_3DLIGHT ) ) self.SetIcon(wx.Icon(logopath, wx.BITMAP_TYPE_ICO)) self.SetSizeHints( wx.DefaultSize, wx.DefaultSize ) sizer = wx.BoxSizer( wx.VERTICAL ) self.canvas = LineCanvas( self) #self.canvas.set_data(np.random.rand(256)*100) #self.canvas.set_lim(0, 0) sizer.Add( self.canvas, 1, wx.EXPAND |wx.ALL, 5 ) sizer2 = wx.BoxSizer( wx.HORIZONTAL ) self.lab_info = wx.StaticText( self, wx.ID_ANY, "Information", wx.DefaultPosition, wx.DefaultSize, 0 ) self.lab_info.Wrap( -1 ) sizer2.Add( self.lab_info, 0, wx.ALL, 5 ) sizer2.AddStretchSpacer(1) self.btn_save = wx.Button( self, wx.ID_ANY, "Save", wx.DefaultPosition, wx.DefaultSize, 0 ) sizer2.Add( self.btn_save, 0, wx.ALL, 5 ) self.btn_cancel = wx.Button( self, wx.ID_ANY, "Cancel", wx.DefaultPosition, wx.DefaultSize, 0 ) sizer2.Add( self.btn_cancel, 0, wx.ALL, 5 ) sizer.Add( sizer2, 0, wx.ALL|wx.EXPAND, 5 ) self.SetSizer( sizer ) self.Layout() self.Centre( wx.BOTH ) self.canvas.handle_move = self.handle_move self.Bind(wx.EVT_CLOSE, self.on_closing) self.btn_cancel.Bind(wx.EVT_BUTTON, self.on_cancel) self.btn_save.Bind(wx.EVT_BUTTON, self.on_save) self.set_title_label = self.canvas.set_title_label self.add_data = self.canvas.add_data self.clear = self.canvas.clear
def __init__(self, parent, title, hist): wx.Frame.__init__(self, parent, title=title, style = wx.DEFAULT_DIALOG_STYLE) logopath = os.path.join(root_dir, 'data/logo.ico') self.SetIcon(wx.Icon(logopath, wx.BITMAP_TYPE_ICO)) if len(hist)==3:self.rgb(hist) else: self.gray(hist)
def __init__( self, parent,): wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = 'Plugin List', pos = wx.DefaultPosition, size = wx.Size( 612,500 ), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL ) logopath = os.path.join(root_dir, 'data/logo.ico') self.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_3DLIGHT ) ) self.SetIcon(wx.Icon(logopath, wx.BITMAP_TYPE_ICO)) self.SetSizeHints( wx.DefaultSize, wx.DefaultSize ) bSizer1 = wx.BoxSizer( wx.VERTICAL ) bSizer2 = wx.BoxSizer( wx.HORIZONTAL ) self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, "Search:", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText1.Wrap( -1 ) bSizer2.Add( self.m_staticText1, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.txt_search = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 ) bSizer2.Add( self.txt_search, 1, wx.ALL, 5 ) bSizer1.Add( bSizer2, 0, wx.EXPAND, 5 ) self.lst_plgs = VirtualListCtrl( self, ['Name', 'Location']) self.lst_plgs.SetColumnWidth(0,200) self.lst_plgs.SetColumnWidth(1,400) bSizer1.Add( self.lst_plgs, 1, wx.ALL|wx.EXPAND, 5 ) self.SetSizer( bSizer1 ) self.Layout() self.Centre( wx.BOTH ) # Connect Events self.txt_search.Bind( wx.EVT_TEXT, self.on_search ) self.lst_plgs.Bind( wx.EVT_LIST_ITEM_ACTIVATED, self.on_run ) self.load()
def __init__( self, parent): wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = 'Plugin List', pos = wx.DefaultPosition, size = wx.Size( 412,500 ), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL ) logopath = os.path.join(root_dir, 'data/logo.ico') self.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_3DLIGHT ) ) self.SetIcon(wx.Icon(logopath, wx.BITMAP_TYPE_ICO)) self.SetSizeHints( wx.DefaultSize, wx.DefaultSize ) bSizer1 = wx.BoxSizer( wx.VERTICAL ) bSizer2 = wx.BoxSizer( wx.HORIZONTAL ) self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, "Search:", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText1.Wrap( -1 ) bSizer2.Add( self.m_staticText1, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.txt_search = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 ) bSizer2.Add( self.txt_search, 1, wx.ALL, 5 ) bSizer1.Add( bSizer2, 0, wx.EXPAND, 5 ) self.lst_plgs = VirtualListCtrl( self, ['Name', 'Shotcut']) self.lst_plgs.SetColumnWidth(0,200) self.lst_plgs.SetColumnWidth(1,200) bSizer1.Add( self.lst_plgs, 1, wx.ALL|wx.EXPAND, 5 ) self.SetSizer( bSizer1 ) self.Layout() self.Centre( wx.BOTH ) # Connect Events self.txt_search.Bind( wx.EVT_TEXT, self.on_search ) self.lst_plgs.Bind(wx.EVT_LIST_KEY_DOWN, self.on_run) self.load() self.Bind(wx.EVT_CLOSE, self.on_close)
def __init__(self, *args, **kwds): wx.Frame.__init__(self, *args, **kwds) self.icon = wx.Icon("/usr/share/icons/hicolor/128x128/apps/switch-icon.png", wx.BITMAP_TYPE_PNG) self.SetIcon(self.icon) with open(CurrentHosts, "rb") as fp: self.current = fp.read() self.all_hosts = get_all_hosts() self.combo_box_1 = wx.ComboBox(self, wx.ID_ANY, choices = self.all_hosts, style = wx.CB_DROPDOWN) index = 0 try: index = self.all_hosts.index(self.current) except Exception: pass self.combo_box_1.Select(index) self.button_add = wx.Button(self, wx.ID_ANY, "Add") self.button_delete = wx.Button(self, wx.ID_ANY, "Delete") self.button_edit = wx.Button(self, wx.ID_ANY, "Edit") self.button_set = wx.Button(self, wx.ID_ANY, "Set") self.Bind(wx.EVT_BUTTON, self.OnAdd, self.button_add) self.Bind(wx.EVT_BUTTON, self.OnDelete, self.button_delete) self.Bind(wx.EVT_BUTTON, self.OnEdit, self.button_edit) self.Bind(wx.EVT_BUTTON, self.OnSet, self.button_set) self.statusbar = self.CreateStatusBar(1) self.__set_properties() self.__do_layout()
def __init__(self): wx.Frame.__init__(self, None, title='Image Extractor') self.panel = wx.Panel(self) loc = wx.IconLocation(r'C:\Python35\python.exe', 0) self.SetIcon(wx.Icon(loc))
def __init__(self): wx.Frame.__init__(self, None, title='Custom Image') self.panel = wx.Panel(self, wx.ID_ANY) ico = wx.Icon('py.ico', wx.BITMAP_TYPE_ICO) self.SetIcon(ico)
def __init__(self, frame): wx.TaskBarIcon.__init__(self) self.frame = frame # Set the image icon = wx.Icon('python.ico', wx.BITMAP_TYPE_ICO) self.SetIcon(icon, "Python") # bind some events self.Bind(wx.EVT_MENU, self.OnTaskBarClose, id=self.TBMENU_CLOSE) self.Bind(wx.EVT_TASKBAR_LEFT_DOWN, self.OnTaskBarLeftClick)
def __init__(self, frame): wx.adv.TaskBarIcon.__init__(self) self.frame = frame # Set the image icon = wx.Icon('python.ico', wx.BITMAP_TYPE_ICO) self.SetIcon(icon, "Python") # bind some events self.Bind(wx.EVT_MENU, self.OnTaskBarClose, id=self.TBMENU_CLOSE) self.Bind(wx.adv.EVT_TASKBAR_LEFT_DOWN, self.OnTaskBarLeftClick)
def __init__(self, frame): """Constructor""" wx.TaskBarIcon.__init__(self) self.frame = frame icon = wx.Icon('python.ico', wx.BITMAP_TYPE_ICO) self.SetIcon(icon, "Restore") self.Bind(wx.EVT_TASKBAR_LEFT_DOWN, self.OnTaskBarLeftClick)
def __init__(self, *args, **kwargs): if 'size' not in kwargs: kwargs['size'] = (360, 240) super(NewPartitionDialog, self).__init__(*args, **kwargs) # ico = wx.Icon(r'./icons/plus32x32.ico', wx.BITMAP_TYPE_ICO) # self.SetIcon(ico) fgs = wx.BoxSizer(wx.HORIZONTAL) main_label = wx.StaticText(self, label="Fill up the cell below to create a new partition.") name_label = wx.StaticText(self, label="Name Partition: ") # unit_label = wx.StaticText(self, label="Unidade: ") self.name_ctrl = wx.TextCtrl(self) # self.unit_ctrl = wx.TextCtrl(self) fgs.Add(name_label, 0, wx.EXPAND) fgs.Add(self.name_ctrl, 1, wx.EXPAND) # fgs.AddGrowableRow(0) sizer = wx.BoxSizer(wx.VERTICAL) button_sizer = self.CreateButtonSizer(wx.OK | wx.CANCEL) #if _iswxphoenix: sizer.Add(main_label, 1, wx.GROW | wx.EXPAND) sizer.Add(fgs, 0, wx.EXPAND) sizer.Add(button_sizer, 0, wx.EXPAND) #else: # sizer.AddSizer(fgs, proportion=1, flag=wx.EXPAND) # sizer.AddSizer(button_sizer, proportion=0, flag=wx.EXPAND) # self. self.SetSizer(sizer) self.name_ctrl.SetFocus()
def __init__(self, controller_uid): TopLevel.__init__(self, controller_uid) UIM = UIManager() controller = UIM.get(self._controller_uid) # parent_uid = UIM._getparentuid(self._controller_uid) parent_obj = UIM.get(parent_uid) if not parent_obj: parent_view = None else: parent_view = parent_obj.view # wx.Frame.__init__(self, parent_view, wx.ID_ANY, controller.model.title, pos=controller.model.pos, size=controller.model.size, style=controller.model.style ) if controller.model.icon: self.icon = wx.Icon(controller.model.icon, wx.BITMAP_TYPE_ICO) self.SetIcon(self.icon) if controller.model.maximized: self.Maximize() self.Bind(wx.EVT_MAXIMIZE, self.on_maximize) self.Bind(wx.EVT_SIZE, self.on_size) self.Bind(wx.EVT_MOVE, self.on_move) ############################################################################### ###############################################################################
def OnAbout(self,e): description =\ """Bonsu is a collection of tools and algorithms primarily for the reconstruction of phase information from diffraction intensity measurements.""" licence =\ """This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.""" if IsNotWX4(): info = wx.AboutDialogInfo() else: info = wx.adv.AboutDialogInfo() info.SetIcon(wx.Icon(os.path.join(os.path.dirname(os.path.dirname(__file__)),'image', 'bonsu.ico'), wx.BITMAP_TYPE_ICO)) info.SetName('Bonsu') info.SetVersion(__version__) info.SetDescription(description) info.SetCopyright('Copyright (C) 2011-2017 Marcus C. Newton') info.SetWebSite('github.com/bonsudev/bonsu') info.SetLicence(licence) info.AddDeveloper('Marcus C. Newton') self.version_str_list = [] self.version_str_list.append("Python "+str(sys.version_info.major)+"."+str(sys.version_info.minor)+"."+str(sys.version_info.micro)) self.version_str_list.append("wxPython "+wx.version()) self.version_str_list.append("NumPy "+numpy.version.version) self.version_str_list.append("VTK "+vtk.vtkVersion().GetVTKVersion()) self.version_str_list.append("PIL "+Image.VERSION) try: import h5py self.version_str_list.append("h5Py "+h5py.version.version) except: pass self.version_str_list.append("Build date: "+__builddate__) info.SetArtists(self.version_str_list) dialog = CustomAboutDialog(self,info) dialog.ShowModal() dialog.Destroy()
def __init__(self): grc_wxgui.top_block_gui.__init__(self, title="Top Block") _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png" self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY)) ################################################## # Variables ################################################## self.samp_rate = samp_rate = 2000000 ################################################## # Blocks ################################################## self.wxgui_waterfallsink2_0 = waterfallsink2.waterfall_sink_c( self.GetWin(), baseband_freq=930000000, dynamic_range=100, ref_level=0, ref_scale=2.0, sample_rate=samp_rate, fft_size=512, fft_rate=15, average=False, avg_alpha=None, title='Waterfall Plot', ) self.Add(self.wxgui_waterfallsink2_0.win) self.wxgui_fftsink2_0 = fftsink2.fft_sink_c( self.GetWin(), baseband_freq=930000000, y_per_div=10, y_divs=10, ref_level=0, ref_scale=2.0, sample_rate=samp_rate, fft_size=1024, fft_rate=15, average=False, avg_alpha=None, title='FFT Plot', peak_hold=False, ) self.Add(self.wxgui_fftsink2_0.win) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate,True) self.blocks_file_source_0 = blocks.file_source(gr.sizeof_gr_complex*1, '/home/bill/signal_hunter/out.iq', True) ################################################## # Connections ################################################## self.connect((self.blocks_file_source_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.wxgui_fftsink2_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.wxgui_waterfallsink2_0, 0))
def __init__(self, trayicon, tooltip): super(TaskBarIcon, self).__init__() self.show_no_updates = False # Set trayicon and tooltip icon = wx.Icon(wx.Bitmap(trayicon)) self.SetIcon(icon, tooltip) self.Bind(wx.adv.EVT_TASKBAR_LEFT_DCLICK, self.on_upgrade) self.Bind(wx.adv.EVT_TASKBAR_BALLOON_CLICK, self.on_bubble) self.upd_error_count = 0 self.checking_updates = False self.updates_available = False self.shutdown_scheduled = False self.reboot_scheduled = False self.bootup_time = getBootUp() if update_interval and update_method: self.timer = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.on_timer, self.timer) self.timer.Start(update_interval) if update_startup: self.on_timer(None) if check_bootup_log: last_check = check_file_date(xml_file) now = datetime.datetime.now() if (self.bootup_time + datetime.timedelta(hours=1) > now) and \ (self.bootup_time + datetime.timedelta(minutes=30) > last_check): log, errorlog, reboot = check_eventlog(self.bootup_time) if errorlog: error_str = _(u"Update error detected\n" u"during system start up.") self.ShowBalloon(title=_(u'WPKG Error'), text=error_str, msec=20*1000, flags=wx.ICON_ERROR) title = _(u"System start error") dlg = ViewLogDialog(title=title,log=errorlog) dlg.ShowModal() if check_last_upgrade: # Check if the last changes to the local wpkg.xml are older than a specific time # Inform USER that he should upgrade the System last_check = check_file_date(xml_file) if last_check < (datetime.datetime.now() - datetime.timedelta(days=last_upgrade_interval)): dlg_str = _(u"System should be updated!\n\n" u"System wasn't updated in over {} days.").format(str(last_upgrade_interval)) dlg = wx.MessageDialog(None, dlg_str, _(u"Attention!"), wx.OK | wx.ICON_EXCLAMATION) dlg.ShowModal() self.on_upgrade(None)
def __init__(self): FrameMainBase.__init__(self, None) self.SetIcon(wx.Icon(u'res/icon-diamond.ico')) self.Enable(False) self.Status.SetFieldsCount(1) self._edit_mode_dialogs = { ui.dialogs.EDIT_TILES: EditMode.TILES, ui.dialogs.EDIT_ENTITIES: EditMode.ENTITIES, ui.dialogs.EDIT_START: EditMode.START } self._edit_mode_panels = { EditMode.TILES: self.PanelModeTiles, EditMode.ENTITIES: self.PanelModeEntities, EditMode.START: self.PanelModeStart } self._edit_modes = { EditMode.TILES: EditModeTiles(self), EditMode.ENTITIES: EditModeEntities(self), EditMode.START: EditModeStart(self), } self._edit_mode = None self._game_dir = None self._mouse_state = MouseState.NONE self._move_last_pos = 0 self._graphics = None self._worlds = None self._world = None self._level = None self._presenter = None self._camera = None self._draw_tile_collision = False self._always_draw_entities = True self._draw_blockmap = False self._font = Font.from_png('fonts/zepto.png') self.set_mode(EditMode.TILES) self.update_menu_state() self.Tiles.Bind(ui.tileselector.TileSelector.EVT_SELECT_EVENT, self.selection_tile) self.Entities.Bind(ui.entitypicker.EntityPicker.EVT_ENTITY_PICK_EVENT, self.selection_entity) self.Bind(wx.EVT_CHAR_HOOK, self.char_hook) self.Maximize() self.Show() self.Enable(True)
def __init__(self, parent=None): wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = wx.EmptyString, pos = wx.DefaultPosition, size = wx.Size( -1,-1 ), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL ) logopath = os.path.join(root_dir, 'data/logo.ico') self.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_3DLIGHT ) ) self.SetIcon(wx.Icon(logopath, wx.BITMAP_TYPE_ICO)) self.SetSizeHints( wx.Size( 560,-1 ), wx.DefaultSize ) WindowsManager.add(self) print('frame added') self.SetSizeHints( wx.DefaultSize, wx.DefaultSize ) self.SetBackgroundColour( wx.Colour( 255, 255, 255 ) ) sizer = wx.BoxSizer( wx.VERTICAL ) self.txt_info = wx.StaticText( self, wx.ID_ANY, '500*500 pixels 173k', wx.DefaultPosition, wx.DefaultSize, 0 ) self.txt_info.Wrap( -1 ) sizer.Add( self.txt_info, 0, wx.ALL, 0 ) self.canvas = Canvas(self) self.canvas.fit = self sizer.Add( self.canvas, 1, wx.EXPAND |wx.ALL, 0 ) self.page = wx.ScrollBar( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.SB_HORIZONTAL) self.page.SetScrollbar(0,0,0,0, refresh=True) sizer.Add( self.page, 0, wx.ALL|wx.EXPAND, 0 ) #self.page.Hide() self.SetSizer(sizer) self.Layout() self.Bind(wx.EVT_IDLE, self.on_idle) self.Bind(wx.EVT_SCROLL, self.on_scroll) self.Bind(wx.EVT_ACTIVATE, self.on_valid) self.Bind(wx.EVT_CLOSE, self.on_close) self.canvas.Bind(wx.EVT_CHAR, self.on_key) self.canvas.SetFocus() # panel.Bind(wx.EVT_CHAR, self.OnKeyDown) self.opage = 0 self.Fit() self.SetAcceleratorTable(IPy.curapp.shortcut)
def __init__( self, parent ): wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = "Plugins Tree", pos = wx.DefaultPosition, size = wx.Size( 452,300 ), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL ) logopath = os.path.join(root_dir, 'data/logo.ico') self.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_3DLIGHT ) ) self.SetIcon(wx.Icon(logopath, wx.BITMAP_TYPE_ICO)) self.SetSizeHints( wx.DefaultSize, wx.DefaultSize ) bSizer1 = wx.BoxSizer( wx.HORIZONTAL ) self.tre_plugins = wx.TreeCtrl( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TR_DEFAULT_STYLE ) self.tre_plugins.SetMinSize( wx.Size( 200,-1 ) ) bSizer1.Add( self.tre_plugins, 0, wx.ALL|wx.EXPAND, 5 ) bSizer3 = wx.BoxSizer( wx.VERTICAL ) bSizer4 = wx.BoxSizer( wx.HORIZONTAL ) self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, "Plugin Infomation:", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText2.Wrap( -1 ) bSizer4.Add( self.m_staticText2, 0, wx.ALL, 5 ) self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, "[SourceCode]", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText3.Wrap( -1 ) self.m_staticText3.SetForegroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_HIGHLIGHT ) ) bSizer4.Add( self.m_staticText3, 0, wx.ALL, 5 ) bSizer3.Add( bSizer4, 0, wx.EXPAND, 5 ) self.txt_info = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.TE_MULTILINE ) bSizer3.Add( self.txt_info, 1, wx.ALL|wx.EXPAND, 5 ) bSizer1.Add( bSizer3, 1, wx.EXPAND, 5 ) self.SetSizer( bSizer1 ) self.Layout() self.Centre( wx.BOTH ) # Connect Events self.tre_plugins.Bind( wx.EVT_TREE_ITEM_ACTIVATED, self.on_run ) self.tre_plugins.Bind( wx.EVT_TREE_SEL_CHANGED, self.on_select ) self.m_staticText3.Bind( wx.EVT_LEFT_DOWN, self.on_source ) self.plg = None self.load()