我们从Python开源项目中,提取了以下26个代码示例,用于说明如何使用wx.BITMAP_TYPE_ICO。
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, 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 __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): 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 __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): 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, frame): """Constructor""" wx.adv.TaskBarIcon.__init__(self) self.frame = frame icon = wx.Icon('python.ico', wx.BITMAP_TYPE_ICO) self.SetIcon(icon, "Restore") self.Bind(wx.adv.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 __init__(self, parent, info): wx.Dialog.__init__(self, parent, title="About Bonsu", size=(460,300)) self.SetSizeHints(450,300,-1,-1) self.parent = parent self.info = info self.vboxborder = wx.BoxSizer(wx.VERTICAL) self.vbox = wx.BoxSizer(wx.VERTICAL) self.icon = wx.Image(os.path.join(os.path.dirname(os.path.dirname(__file__)),'image', 'bonsu.ico'), wx.BITMAP_TYPE_ICO) if IsNotWX4(): self.bitmap = wx.BitmapFromImage(self.icon) else: self.bitmap = wx.Bitmap(self.icon) self.staticbmp = wx.StaticBitmap(self, -1, self.bitmap) self.vbox.Add(self.staticbmp, 0, flag=wx.CENTER, border=5) namestr = info.GetName()+" "+info.GetVersion() self.namefont = wx.Font((parent.font.GetPointSize()+8),parent.font.GetFamily(),wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD) self.name = wx.StaticText(self, label=namestr) self.name.SetFont(self.namefont) self.vbox.Add((-1, 5)) self.vbox.Add(self.name, 0, flag=wx.CENTER, border=5) self.vbox.Add((-1, 5)) self.description = wx.StaticText(self, label=info.GetDescription(), style=wx.ALIGN_CENTRE_HORIZONTAL) self.description.Wrap(400) self.vbox.Add(self.description, 0, flag=wx.CENTER, border=5) self.vbox.Add((-1, 5)) self.copyright = wx.StaticText(self, label=info.GetCopyright()) self.vbox.Add(self.copyright, 0, flag=wx.CENTER, border=5) self.vbox.Add((-1, 5)) if IsNotWX4(): self.web = wx.StaticText(self, label=info.GetWebSite()[0]) else: self.web = wx.StaticText(self, label=info.GetWebSiteURL()) self.vbox.Add(self.web, 0, flag=wx.CENTER, border=5) self.vbox.Add((-1, 10)) self.hbox = wx.BoxSizer(wx.HORIZONTAL) self.credits =wx.Button(self, label="More") self.Bind(wx.EVT_BUTTON, self.OnCredits, self.credits) self.hbox.Add(self.credits) self.hbox.Add((10, -1)) self.license =wx.Button(self, label="License") self.Bind(wx.EVT_BUTTON, self.OnLicense, self.license) self.hbox.Add(self.license) self.hbox.Add((10, -1)) self.close =wx.Button(self, label="Close") self.Bind(wx.EVT_BUTTON, self.OnClose, self.close) self.hbox.Add(self.close) self.vbox.Add(self.hbox, 0, flag=wx.CENTER, border=5) self.vbox.Add((-1, 10)) self.vboxborder.Add(self.vbox, 1, flag=wx.CENTER|wx.LEFT|wx.RIGHT|wx.TOP|wx.BOTTOM, border=20) self.SetSizer( self.vboxborder ) self.SetAutoLayout(True) self.Fit() self.Layout() self.Show()
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, 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()