def __init__(self, parent, title): wx.Frame.__init__(self, parent, -1, title) self.config = wx.Config.Get() window_size_x = max(self.config.ReadInt("window_size_x", 800), 800) window_size_y = max(self.config.ReadInt("window_size_y", 600), 600) window_pos_x = max(self.config.ReadInt("window_pos_x", -1), -1) window_pos_y = max(self.config.ReadInt("window_pos_y", -1), -1) self.SetSize((window_size_x, window_size_y)) self.SetPosition((window_pos_x, window_pos_y)) self.SetMinSize((800, 600)) self.SetupMenu() self.SetupToolbar() self.SetupStatusBar() self.SetupSashLayout(self) self.filterviewbuttonsenable = True icons = wx.IconBundle() icons.AddIcon(wx.IconFromBitmap(_afimages.getapp16x16Bitmap())) icons.AddIcon(wx.IconFromBitmap(_afimages.getapp32x32Bitmap())) self.SetIcons(icons) self.rightWindowSizer = wx.BoxSizer(wx.VERTICAL) self.rightWindow.SetSizer(self.rightWindowSizer) self.bottomWindowSizer = wx.BoxSizer(wx.VERTICAL) self.bottomWindow.SetSizer(self.bottomWindowSizer) self.treeCtrl = afProductTree(self.leftWindow) self.treeCtrl.Disable() self.expand = False self.filterview = None
def get_appicons(): icons = wx.IconBundle() [ icons.AddIcon(wx.IconFromBitmap(i.GetBitmap())) for i in [Icon32bit16x16, Icon32bit32x32, Icon8bit16x16, Icon8bit32x32] ] return icons
def __init__(self,parent,utility,download_state): self.utility = utility wx.Frame.__init__(self, None, -1, self.utility.lang.get('tb_dlhelp_short'), size=(640,520)) main_panel = wx.Panel(self) self.downloadHelperPanel = self.createMainPanel(main_panel,download_state) bot_box = self.createBottomBoxer(main_panel) mainbox = wx.BoxSizer(wx.VERTICAL) mainbox.Add(self.downloadHelperPanel, 1, wx.EXPAND|wx.ALL, 5) mainbox.Add(bot_box, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, 5) main_panel.SetSizer(mainbox) iconpath = os.path.join(self.utility.session.get_tracker_favicon()) # Giving it the whole bundle throws an exception about image 6 self.icons = wx.IconBundle() print >> sys.stderr, iconpath if iconpath: self.icons.AddIconFromFile(iconpath,wx.BITMAP_TYPE_ICO) self.SetIcons(self.icons) self.Bind(wx.EVT_CLOSE, self.OnCloseWindow) self.Show()
def __init__(self, parent, *args, **kwargs): """do any initial setup required for Orbis""" super().__init__(parent, *args, **kwargs) ico = wx.IconBundle() icon_path = settings.get_img_path("qcpump.ico") logger.debug(f"Loading icons from {icon_path}") ico.AddIcon(icon_path) self.SetTitle(f"QCPump - {settings.VERSION}") self.SetIcons(ico) self.SetMinSize((1024, 768)) self.Fit() self.Center() self.do_pump_on_startup.SetValue(settings.PUMP_ON_STARTUP) self.pump_windows = {} # do expensive intialization after show event self._init_finished = False self._show_completed = True self._startup_pump_run = False # used to track when user has asked to stop pumping self.kill_event = threading.Event()
def __init__(self, parent, title): super(GameFrame, self).__init__(parent, title=title, size=wx.Size(480 + 20, 640 + 20), style=wx.DEFAULT_FRAME_STYLE ^ wx.MAXIMIZE_BOX ^ wx.RESIZE_BORDER) self.arrow = "" self.background = wx.Colour("#FAFAFA") self.tabbar = Tabbar() self.board = Board() self.directions = { wx.WXK_UP: "↑", wx.WXK_DOWN: "↓", wx.WXK_LEFT: "←", wx.WXK_RIGHT: "→" } self.SetIcons(wx.IconBundle(wx.Icon("2048.ico"))) self.SetTransparent(235) self.CentreOnScreen() self.SetBackgroundColour(self.background) self.CreateStatusBar() self.SetStatusText("Welcome to Game 2048!") self.Bind(wx.EVT_PAINT, self.OnPaint) self.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown) self.GameStart()
def test_iconbndl4(self): ib = wx.IconBundle() ib.Icon ib.IconCount wx.NullIconBundle
def createOutputWindow(self, st): if FxStudio.getConsoleVariableAsSwitch( 'py_enableoutputwindow') == True: self.frame = wx.Frame(FxStudio.getMainWindow(), -1, self.title, self.pos, self.size, style=wx.DEFAULT_FRAME_STYLE) self.text = wx.TextCtrl(self.frame, -1, "", style=wx.TE_MULTILINE | wx.TE_READONLY) self.text.SetFont( wx.Font(8, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, FxStudio.getUnicodeFontName(), wx.FONTENCODING_SYSTEM)) self.text.SetBackgroundColour(self.color_palette['BaseColour1']) self.text.SetForegroundColour(self.color_palette['BaseColour8']) ib = wx.IconBundle() ib.AddIconFromFile(FxStudio.getAppIconPath(), wx.BITMAP_TYPE_ANY) self.frame.SetIcons(ib) self.text.AppendText(st) self.log_to_file(st) self.frame.Show(True) self.frame.Bind(wx.EVT_CLOSE, self.onCloseWindow) else: self.log_to_file(st)
def set_icons(self, filepath): icons = wx.IconBundle() if const.IS_WX4: icons.AddIcon(utils.tr(filepath), wx.BITMAP_TYPE_ANY) else: icons.AddIconFromFile(utils.tr(filepath), wx.BITMAP_TYPE_ANY) self.SetIcons(icons)
def addIcons(self): icons = wx.IconBundle() icons.AddIcon(Icons.icon16.Icon) icons.AddIcon(Icons.icon32.Icon) icons.AddIcon(Icons.icon48.Icon) icons.AddIcon(Icons.icon256.Icon) self.SetIcons(icons)
def ICON(): global _icon if _icon is None: fn = _find_asset("icon.ico") with open(fn, 'rb') as fp: _icon = wx.IconBundle(fp) return _icon
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.SetSize((800, 600)) #tb = self.CreateToolBar( TBFLAGS ) #tsize = wx.Size(16,16) #hd_bmp = wx.ArtProvider.GetBitmap(wx.ART_HARDDISK, wx.ART_TOOLBAR, tsize) #flop_bmp = wx.ArtProvider.GetBitmap(wx.ART_FLOPPY, wx.ART_TOOLBAR, tsize) #flop_bmp = wx.Bitmap('pencil6c_mac_24.png') #cd_bmp = wx.ArtProvider.GetBitmap(wx.ART_CDROM, wx.ART_TOOLBAR, tsize) #test_bmp = wx.Bitmap(my_bitmap) #tb.SetToolBitmapSize(tsize) #tool = tb.AddRadioTool( wx.ID_ANY, "Radio0", hd_bmp, # shortHelp="Radio 0") #tool = tb.AddRadioTool(wx.ID_ANY, "Radio1", flop_bmp, # shortHelp="Radio 1") #tool = tb.AddRadioTool(wx.ID_ANY, "Radio2", test_bmp, # shortHelp="Radio 2") #tb.Realize() my_icon_bundle = wx.IconBundle('marcam.ico') #my_icon_bundle = wx.IconBundle('marcam.icns') self.SetIcons(my_icon_bundle) self.Show(True)
def OnInit(self): self.model = Model() self.startupservice = StartupService() self.frame_console = wx.py.shell.ShellFrame(None) self.trayicon = wx.TaskBarIcon() if os.path.exists(conf.IconPath): icons = wx.IconBundle() icons.AddIconFromFile(conf.IconPath, wx.BITMAP_TYPE_ICO) self.frame_console.SetIcons(icons) icon = (icons.GetIconOfExactSize( (16, 16)) if "win32" == sys.platform else icons.GetIcon( (24, 24))) self.trayicon.SetIcon(icon, conf.Title) self.frame_console.Title = "%s Console" % conf.Title self.Bind(wx.EVT_CLOSE, self.OnClose) self.Bind(wx.EVT_DISPLAY_CHANGED, self.OnDisplayChanged) self.trayicon.Bind(wx.EVT_TASKBAR_LEFT_DCLICK, self.OnOpenUI) self.trayicon.Bind(wx.EVT_TASKBAR_LEFT_DOWN, self.OnOpenMenu) self.trayicon.Bind(wx.EVT_TASKBAR_RIGHT_DOWN, self.OnOpenMenu) self.frame_console.Bind(wx.EVT_CLOSE, self.OnToggleConsole) wx.CallAfter(self.model.log_resolution, wx.GetDisplaySize()) wx.CallAfter(self.model.start) return True # App.OnInit returns whether processing should continue
def _setIcon(self, val): if self._constructed(): setIconFunc = self.SetIcon if val is None: ico = wx.NullIcon elif isinstance(val, wx.Icon): ico = val else: setIconFunc = self.SetIcons if isinstance(val, basestring): icon_strs = (val,) else: icon_strs = val ico = wx.IconBundle() for icon_str in icon_strs: iconPath = dabo.icons.getIconFileName(icon_str) if iconPath and os.path.exists(iconPath): ext = os.path.splitext(iconPath)[1].lower() if ext == ".png": bitmapType = wx.BITMAP_TYPE_PNG elif ext == ".ico": bitmapType = wx.BITMAP_TYPE_ICO else: # punt: bitmapType = wx.BITMAP_TYPE_ANY single_ico = wx.Icon(iconPath, bitmapType) else: single_ico = wx.NullIcon ico.AddIcon(single_ico) # wx doesn't provide GetIcon() self._icon = val setIconFunc(ico) else: self._properties["Icon"] = val
def __init__(self, parent, utility, title, iconpath, vlcwrap, logopath): ## rm utility self.parent = parent self.utility = utility ## parent.utility if title is None: title = self.utility.lang.get('tb_video_short') if vlcwrap is None: size = (800, 150) else: if sys.platform == 'darwin': size = (800, 520) else: size = ( 800, 520 ) # Use 16:9 aspect ratio: 500 = (800/16) * 9 + 50 for controls wx.Frame.__init__(self, None, -1, title, size=size) self.Centre() self.create_videopanel(vlcwrap, logopath) # Set icons for Frame self.icons = wx.IconBundle() self.icons.AddIconFromFile(iconpath, wx.BITMAP_TYPE_ICO) self.SetIcons(self.icons) self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
def GetFrameMainIconBundle(): ib = wx.IconBundle() ib.AddIcon(wx.ArtProvider.GetIcon('logo_16')) ib.AddIcon(wx.ArtProvider.GetIcon('logo_32')) ib.AddIcon(wx.ArtProvider.GetIcon('logo_48')) ib.AddIcon(wx.ArtProvider.GetIcon('logo_64')) return ib
def setIcon(self, from_r, from_g, from_b, to_r, to_g, to_b): ib = wx.IconBundle() bmp = self.make_grad_image(32, 32, (from_r, from_g, from_b), (to_r, to_g, to_b)) icon = wx.EmptyIcon() icon.CopyFromBitmap(bmp) ib.AddIcon(icon) self.mainWindow.SetIcons(ib)
def set_icon(window): bundle = wx.IconBundle() bundle.AddIcon(wx.Icon('icons/16.png', wx.BITMAP_TYPE_PNG)) bundle.AddIcon(wx.Icon('icons/24.png', wx.BITMAP_TYPE_PNG)) bundle.AddIcon(wx.Icon('icons/32.png', wx.BITMAP_TYPE_PNG)) bundle.AddIcon(wx.Icon('icons/48.png', wx.BITMAP_TYPE_PNG)) bundle.AddIcon(wx.Icon('icons/256.png', wx.BITMAP_TYPE_PNG)) window.SetIcons(bundle)
def _set_frame_icon(frame): bundle = wx.IconBundle() for image in ('matplotlib.png', 'matplotlib_large.png'): icon = wx.Icon(_load_bitmap(image)) if not icon.IsOk(): return bundle.AddIcon(icon) frame.SetIcons(bundle)
def get_icon_resource(name): """Convert a Window ICO contained in a string to an IconBundle.""" bundle = wx.IconBundle() for img in _get_icon_resource_as_images(name): bmp = wx.Bitmap(img) icon = wx.Icon(bmp) bundle.AddIcon(icon) return bundle
def setup_icon(self): # icon_file = get_root_path('icon.ico') # # wx.IconFromBitmap is not available on Linux in wxPython 3.0/4.0 # if os.path.exists(icon_file) and hasattr(wx, "IconFromBitmap"): # icon = wx.IconFromBitmap(wx.Bitmap(icon_file, wx.BITMAP_TYPE_PNG)) # self.SetIcon(icon) ib = wx.IconBundle() ib.AddIcon(get_root_path('icon.ico'), wx.BITMAP_TYPE_ANY) self.SetIcons(ib)
def setIcon(self): ib = wx.IconBundle() if current.outputMode: bmp = self.make_grad_image(32, 32, (255, 255, 0), (0, 0, 0)) else: bmp = self.make_grad_image(32, 32, (0, 0, 0), (0, 0, 0)) icon = wx.EmptyIcon() icon.CopyFromBitmap(bmp) ib.AddIcon(icon) self.mainWindow.SetIcons(ib)
def get_frame_icon_bundle(self, bundleid): # wx.ArtProvider would have a GetIconBundle method, but it's not easy # to understand how to use it... if it's actually # implemented/tested/maintained at all... bundle = wx.IconBundle() for path in self.bundles[bundleid]: bundle.AddIcon(wx.Icon(path)) return bundle
def __init__(self, wxapp, iconfilename): wx.TaskBarIcon.__init__(self) self.wxapp = wxapp self.icons = wx.IconBundle() self.icons.AddIconFromFile(iconfilename, wx.BITMAP_TYPE_ICO) self.icon = self.icons.GetIcon(wx.Size(-1, -1)) if sys.platform != "darwin": # Mac already has the right icon set at startup self.SetIcon(self.icon, self.wxapp.appname)
def add_icon(frame): """ Probably best to add largest first: http://stackoverflow.com/questions/525329/embedding-icon-in-exe-with-py2exe-visible-in-vista/6198910#6198910 """ ib = wx.IconBundle() for sz in (128, 64, 48, 32, 16): icon_path = str( Path(mg.SCRIPT_PATH) / 'images' / f'sofastats_{sz}.xpm') ib.AddIcon(icon_path, wx.BITMAP_TYPE_XPM) frame.SetIcons(ib)
def __init__(self, redirect=False): wx.App.__init__(self) ib = wx.IconBundle() bmp = self.make_grad_image(32, 32, (0, 0, 0), (0, 0, 0)) icon = wx.EmptyIcon() icon.CopyFromBitmap(bmp) ib.AddIcon(icon) self.mainWindow = GUIMain() self.setIcon(0, 0, 0, 0, 0, 0) self.mainWindow.Center() self.mainWindow.Show(True)
def setIcon(self): ib = wx.IconBundle() if current.outputMode: bmp = self.make_grad_image(32,32, (255,255,0), (0,0,0)) self.mainWindow.currentTopPanel.outputButton.SetLabel("Pause Output ( Ctrl End )") else: bmp = self.make_grad_image(32,32, (0,0,0), (0,0,0)) self.mainWindow.currentTopPanel.outputButton.SetLabel("Continue Output ( Ctrl Home )") icon = wx.EmptyIcon() icon.CopyFromBitmap(bmp) ib.AddIcon(icon) self.mainWindow.SetIcons(ib)
def __init__(self, redirect=False): wx.App.__init__(self) ib = wx.IconBundle() bmp = self.make_grad_image(32, 32, (0, 0, 0), (0, 0, 0)) icon = wx.EmptyIcon() icon.CopyFromBitmap(bmp) ib.AddIcon(icon) self.mainWindow = GUIMain() self.mainWindow.SetIcons(ib) self.mainWindow.Center() self.mainWindow.Show(True) self.mainWindow.timer.Start(int(1000.0 / profile.niaFPS))
def icon_bundle(fn): """ wx doesn't automatically load all the different sizes from a .ico :( """ icons = wx.IconBundle() for sz in [16, 32, 48]: try: icon = wx.Icon(fn, wx.BITMAP_TYPE_ICO, desiredWidth=sz, desiredHeight=sz) icons.AddIcon(icon) except: pass return icons
def __init__(self, redirect=False): wx.App.__init__(self) ib = wx.IconBundle() bmp = wx.Image('icons' + os.sep + 'triathlon.png', wx.BITMAP_TYPE_ANY).ConvertToBitmap() icon = wx.EmptyIcon() icon.CopyFromBitmap(bmp) ib.AddIcon(icon) self.mainWindow = StarterMain() self.mainWindow.SetIcons(ib) self.mainWindow.Center() self.mainWindow.Show(True)
def icon_bundle(fn): import wx icons = wx.IconBundle() for sz in [16, 32, 48]: try: icon = wx.Icon(fn, wx.BITMAP_TYPE_ICO, desiredWidth=sz, desiredHeight=sz) icons.AddIcon(icon) except: pass return icons