Python wx.BITMAP_TYPE_ANY Examples
The following are 27
code examples of wx.BITMAP_TYPE_ANY().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
wx
, or try the search function
.
Example #1
Source File: configuration_dialogs.py From superpaper with MIT License | 7 votes |
def create_thumb_bmp(self, filename): wximg = wx.Image(filename, type=wx.BITMAP_TYPE_ANY) imgsize = wximg.GetSize() w2h_ratio = imgsize[0]/imgsize[1] if w2h_ratio > 1: target_w = self.tsize[0] target_h = target_w/w2h_ratio pos = (0, round((target_w - target_h)/2)) else: target_h = self.tsize[1] target_w = target_h*w2h_ratio pos = (round((target_h - target_w)/2), 0) bmp = wximg.Scale(target_w, target_h, quality=wx.IMAGE_QUALITY_BOX_AVERAGE ).Resize(self.tsize, pos ).ConvertToBitmap() return bmp # # BUTTON methods #
Example #2
Source File: displayDialog.py From Zulu with GNU Affero General Public License v3.0 | 6 votes |
def __set_properties(self): # begin wxGlade: DisplayDialog.__set_properties _icon = wx.EmptyIcon() path = self.outputwin.workingdir _icon.CopyFromBitmap(wx.Bitmap(path + "/../images/zulu_logo16x16.png", wx.BITMAP_TYPE_ANY)) self.SetIcon(_icon) self.SetTitle("display settings") #initialize depend on settings self.radio_box_crlf.SetSelection(self.preNewline) self.radio_box_echo.SetSelection(self.preEcho) self.radio_box_unprintable.SetSelection(self.preUnprintable) self.button_font.SetMinSize((65, 32)) self.button_forecolor.SetMinSize((65, 29)) self.button_backcolor.SetMinSize((65, 32)) # end wxGlade
Example #3
Source File: gui.py From superpaper with MIT License | 6 votes |
def create_thumb_bmp(self, filename): wximg = wx.Image(filename, type=wx.BITMAP_TYPE_ANY) imgsize = wximg.GetSize() w2h_ratio = imgsize[0]/imgsize[1] if w2h_ratio > 1: target_w = self.tsize[0] target_h = target_w/w2h_ratio pos = (0, round((target_w - target_h)/2)) else: target_h = self.tsize[1] target_w = target_h*w2h_ratio pos = (round((target_h - target_w)/2), 0) bmp = wximg.Scale( target_w, target_h, quality=wx.IMAGE_QUALITY_BOX_AVERAGE ).Resize( self.tsize, pos ).ConvertToBitmap() return bmp
Example #4
Source File: settingsDialog.py From Zulu with GNU Affero General Public License v3.0 | 6 votes |
def __set_properties(self): # begin wxGlade: SerialDialog.__set_properties self.SetTitle("Port Settings") _icon = wx.EmptyIcon() path = self.outputwin.workingdir _icon.CopyFromBitmap(wx.Bitmap(path + "/../images/zulu_logo16x16.png", wx.BITMAP_TYPE_ANY)) self.SetIcon(_icon) self.combo_box_port.SetMinSize((120, 29)) self.combo_box_baudrate.SetMinSize((120, 29)) self.combo_box_bytesize.SetMinSize((120, 29)) self.combo_box_parity.SetMinSize((120, 29)) self.combo_box_stopbits.SetMinSize((120, 29)) self.radio_box_rtscts.SetSelection(0) self.radio_box_xonxoff.SetSelection(0) self.button_cancel.SetDefault() self.button_ok.SetDefault() # end wxGlade
Example #5
Source File: uicore.py From NXP-MCUBootUtility with Apache License 2.0 | 6 votes |
def updateConnectStatus( self, color='black' ): self.connectStatusColor = color if color == 'black': self.m_button_connect.SetLabel(uilang.kMainLanguageContentDict['button_connect_black'][self.languageIndex]) self.m_bitmap_connectLed.SetBitmap(wx.Bitmap( u"../img/led_black.png", wx.BITMAP_TYPE_ANY )) elif color == 'yellow': self.m_button_connect.SetLabel(uilang.kMainLanguageContentDict['button_connect_yellow'][self.languageIndex]) self.m_bitmap_connectLed.SetBitmap(wx.Bitmap( u"../img/led_yellow.png", wx.BITMAP_TYPE_ANY )) elif color == 'green': self.m_button_connect.SetLabel(uilang.kMainLanguageContentDict['button_connect_green'][self.languageIndex]) self.m_bitmap_connectLed.SetBitmap(wx.Bitmap( u"../img/led_green.png", wx.BITMAP_TYPE_ANY )) elif color == 'blue': self.m_button_connect.SetLabel(uilang.kMainLanguageContentDict['button_connect_blue'][self.languageIndex]) self.m_bitmap_connectLed.SetBitmap(wx.Bitmap( u"../img/led_blue.png", wx.BITMAP_TYPE_ANY )) self.playSoundEffect(uidef.kSoundEffectFilename_Progress) elif color == 'red': self.m_button_connect.SetLabel(uilang.kMainLanguageContentDict['button_connect_red'][self.languageIndex]) self.m_bitmap_connectLed.SetBitmap(wx.Bitmap( u"../img/led_red.png", wx.BITMAP_TYPE_ANY )) else: pass
Example #6
Source File: easyshell.py From Zulu with GNU Affero General Public License v3.0 | 6 votes |
def __set_properties(self): # begin wxGlade: FrameTerminal.__set_properties #self.SetTitle("serialAssist") _icon = wx.EmptyIcon() path = self.outputwin.workingdir _icon.CopyFromBitmap(wx.Bitmap(path + "/../images/zulu_logo16x16.png", wx.BITMAP_TYPE_ANY)) self.SetIcon(_icon) #self.SetSize((543, 433)) self.SetSize((743, 560)) self.frame_statusbar.SetStatusWidths([-1]) # statusbar fields frame_statusbar_fields = [""] for i in range(len(frame_statusbar_fields)): self.frame_statusbar.SetStatusText(frame_statusbar_fields[i], i) self.frame_toolbar.SetToolBitmapSize((32, 32)) self.frame_toolbar.SetToolSeparation(9) self.frame_toolbar.Realize() self.text_ctrl_output.SetFont(wx.Font(11, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "")) # end wxGlade
Example #7
Source File: make_timelapse.py From Pigrow with GNU General Public License v3.0 | 6 votes |
def graph_caps(self, cap_files, graphdir): OS = "linux" if len(cap_files) > 1: print("make caps graph") if OS == "linux": print("Yay linux") os.system("../visualisation/caps_graph.py caps="+capsdir+" out="+graphdir) elif OS == 'win': print("oh, windows, i prefer linux but no worries...") os.system("python ../visualisation/caps_graph.py caps="+capsdir+" out="+graphdir) else: print("skipping graphing caps - disabled or no caps to make graphs with") if os.path.exists(graphdir+'caps_filesize_graph.png'): cap_size_graph_path = wx.Image(graphdir+'caps_filesize_graph.png', wx.BITMAP_TYPE_ANY) return cap_size_graph_path else: print("NOT ENOUGH CAPS GRAPH SO USING BLANK THUMB") blankimg = wx.EmptyImage(width=100, height=100, clear=True) return blankimg
Example #8
Source File: Gui.py From Crypter with GNU General Public License v3.0 | 6 votes |
def __init__(self): ''' @summary: Constructor @param config_dict: The build configuration, if present @param load_config: Handle to a config loader method/object ''' self.language = DEFAULT_LANGUAGE self.__builder = None self.config_file_path = None # Init super - MainFrame MainFrame.__init__( self, parent=None ) self.console = Console(self.ConsoleTextCtrl) self.StatusBar.SetStatusText("Ready...") icon = wx.Icon() icon.CopyFromBitmap(wx.Bitmap(os.path.join(self.__get_resources_path(), "builder_logo.bmp"), wx.BITMAP_TYPE_ANY)) self.SetIcon(icon) # Update GUI Visuals self.update_gui_visuals() # Set initial event handlers self.set_events()
Example #9
Source File: gui_mixins.py From wxGlade with MIT License | 6 votes |
def get_preview_obj_bitmap(self, bitmap=None): """Create a wx.Bitmap or wx.EmptyBitmap from the given statement. If no statement is given, the instance variable named "bitmap" is used. bitmap: Bitmap definition (str or None) see: get_preview_obj_artprovider(), get_preview_obj_emptybitmap()""" if bitmap is None: bitmap = getattr(self, 'bitmap', None) if not bitmap: return compat.wx_EmptyBitmap(1, 1) if bitmap.startswith('var:') or bitmap.startswith('code:'): return compat.wx_EmptyBitmap(16, 16) elif bitmap.startswith('empty:'): return self.get_preview_obj_emptybitmap(bitmap) elif bitmap.startswith('art:'): return self.get_preview_obj_artprovider(bitmap) else: bitmap = misc.get_absolute_path(bitmap) return wx.Bitmap(bitmap, wx.BITMAP_TYPE_ANY)
Example #10
Source File: main.py From Spider with Apache License 2.0 | 5 votes |
def __init__(self, frame, pnl, item): pic_jd = wx.Image(item.img, wx.BITMAP_TYPE_ANY).ConvertToBitmap() btn_jd = wx.BitmapButton(pnl, -1, pic_jd, pos=(item.x, item.y), size=(100, 100)) wx.StaticText(pnl, -1, item.title, pos=(item.x + 30, item.y + 110)) self.frame = frame self.frame.Bind(wx.EVT_BUTTON, self.OnClick, btn_jd)
Example #11
Source File: make_timelapse.py From Pigrow with GNU General Public License v3.0 | 5 votes |
def updatefirstpic(self, fframe): capsdir = self.capsfolder_box.GetValue() first_pic = str(capsdir + cap_files[fframe]) if os.path.exists(first_pic): first_pic = wx.Image(first_pic, wx.BITMAP_TYPE_ANY) first_pic = self.scale_pic(first_pic, 500) fpicdate = self.date_from_fn(cap_files[fframe]) self.fpic_text.SetLabel('Frame ' + str(fframe) + ' - ' + str(fpicdate)) self.first_pic.SetBitmap(wx.BitmapFromImage(first_pic)) else: self.first_pic.SetBitmap(wx.EmptyBitmap(10,10)) self.fpic_text.SetLabel('start')
Example #12
Source File: make_timelapse.py From Pigrow with GNU General Public License v3.0 | 5 votes |
def updatelastpic(self, lframe): capsdir = self.capsfolder_box.GetValue() last_pic = str(capsdir + cap_files[lframe]) if os.path.exists(last_pic): last_pic = wx.Image(last_pic, wx.BITMAP_TYPE_ANY) last_pic = self.scale_pic(last_pic, 500) self.last_pic.SetBitmap(wx.BitmapFromImage(last_pic)) lpicdate = self.date_from_fn(cap_files[lframe]) self.lpic_text.SetLabel('Frame ' + str(lframe) + ' - ' + str(lpicdate)) else: self.last_pic.SetBitmap(wx.EmptyBitmap(10,10)) self.fpic_text.SetLabel('end')
Example #13
Source File: local_display.py From Pigrow with GNU General Public License v3.0 | 5 votes |
def display_image(self, path_to_image): #img_bmp = wx.StaticBitmap(self, -1, wx.Image(path_to_image, wx.BITMAP_TYPE_ANY).ConvertToBitmap()), 0, wx.ALL, 2) bitmap = wx.Bitmap(1, 1) bitmap.LoadFile(path_to_image, wx.BITMAP_TYPE_ANY) self.img_bmp_box.SetBitmap(bitmap) MainApp.window_self.Layout()
Example #14
Source File: local_display.py From Pigrow with GNU General Public License v3.0 | 5 votes |
def __init__( self, parent ): wx.Panel.__init__ ( self, parent, id = wx.ID_ANY, style = wx.TAB_TRAVERSAL ) # timer self.timer = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.update, self.timer) # Tab Title title_l = wx.StaticText(self, label='Live Display', size=(-1,40)) title_l.SetBackgroundColour((50,250,250)) title_l.SetFont(shared_data.title_font) self.toggleBtn = wx.Button(self, wx.ID_ANY, "Start") self.toggleBtn.Bind(wx.EVT_BUTTON, self.onToggle) bitmap = wx.Bitmap(1, 1) #bitmap.LoadFile(pic_one, wx.BITMAP_TYPE_ANY) size = bitmap.GetSize() self.img_bmp_box = wx.StaticBitmap(self, -1, bitmap, size=(size[0], size[1])) # sizers self.image_sizer = wx.BoxSizer(wx.VERTICAL) self.image_sizer.Add(self.img_bmp_box, 0, wx.EXPAND, 3) main_sizer = wx.BoxSizer(wx.VERTICAL) main_sizer.Add(title_l, 0, wx.ALIGN_CENTER_HORIZONTAL, 3) main_sizer.Add(self.toggleBtn, 0, wx.ALIGN_CENTER_HORIZONTAL, 3) main_sizer.Add(self.image_sizer, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 3) self.SetSizer(main_sizer)
Example #15
Source File: Tool_Menu_EventBinding_Phoenix.py From wxGlade with MIT License | 5 votes |
def __init__(self, *args, **kwds): # begin wxGlade: MyFrame.__init__ kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_FRAME_STYLE wx.Frame.__init__(self, *args, **kwds) self.SetSize((400, 300)) self.SetTitle("frame") # Menu Bar self.frame_menubar = wx.MenuBar() wxglade_tmp_menu = wx.Menu() self.frame_menubar.item1 = wxglade_tmp_menu.Append(wx.ID_ANY, "My Menu Item 1", "") self.Bind(wx.EVT_MENU, self.on_menu_item1, id=self.frame_menubar.item1.GetId()) item = wxglade_tmp_menu.Append(wx.ID_ANY, "My Menu Item 1", "without attribute name") self.Bind(wx.EVT_MENU, self.on_menu_item2, id=item.GetId()) self.frame_menubar.Append(wxglade_tmp_menu, "Menu 1") self.SetMenuBar(self.frame_menubar) # Menu Bar end # Tool Bar self.frame_toolbar = wx.ToolBar(self, -1) tool = self.frame_toolbar.AddTool(wx.ID_ANY, "My Tool", wx.Bitmap("..\\..\\icons\\button.xpm", wx.BITMAP_TYPE_ANY), wx.NullBitmap, wx.ITEM_NORMAL, "", "") self.Bind(wx.EVT_TOOL, self.on_my_tool, id=tool.GetId()) self.SetToolBar(self.frame_toolbar) self.frame_toolbar.Realize() # Tool Bar end sizer_1 = wx.BoxSizer(wx.VERTICAL) sizer_1.Add((0, 0), 0, 0, 0) self.SetSizer(sizer_1) self.Layout() # end wxGlade
Example #16
Source File: Tool_Menu_EventBinding_Classic.py From wxGlade with MIT License | 5 votes |
def __init__(self, *args, **kwds): # begin wxGlade: MyFrame.__init__ kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_FRAME_STYLE wx.Frame.__init__(self, *args, **kwds) self.SetSize((400, 300)) self.SetTitle("frame") # Menu Bar self.frame_menubar = wx.MenuBar() wxglade_tmp_menu = wx.Menu() self.frame_menubar.item1 = wxglade_tmp_menu.Append(wx.ID_ANY, "My Menu Item 1", "") self.Bind(wx.EVT_MENU, self.on_menu_item1, id=self.frame_menubar.item1.GetId()) item = wxglade_tmp_menu.Append(wx.ID_ANY, "My Menu Item 1", "without attribute name") self.Bind(wx.EVT_MENU, self.on_menu_item2, id=item.GetId()) self.frame_menubar.Append(wxglade_tmp_menu, "Menu 1") self.SetMenuBar(self.frame_menubar) # Menu Bar end # Tool Bar self.frame_toolbar = wx.ToolBar(self, -1) tool = self.frame_toolbar.AddLabelTool(wx.ID_ANY, "My Tool", wx.Bitmap("..\\..\\icons\\button.xpm", wx.BITMAP_TYPE_ANY), wx.NullBitmap, wx.ITEM_NORMAL, "", "") self.Bind(wx.EVT_TOOL, self.on_my_tool, id=tool.GetId()) self.SetToolBar(self.frame_toolbar) self.frame_toolbar.Realize() # Tool Bar end sizer_1 = wx.BoxSizer(wx.VERTICAL) sizer_1.Add((0, 0), 0, 0, 0) self.SetSizer(sizer_1) self.Layout() # end wxGlade
Example #17
Source File: gui.py From four_flower with MIT License | 5 votes |
def initimage(self, name): imageShow = wx.Image(name, wx.BITMAP_TYPE_ANY) sb = wx.StaticBitmap(self.pnl, -1, imageShow.ConvertToBitmap(), pos=(0,30), size=(600,400)) return sb
Example #18
Source File: wxwrap.py From grass-tangible-landscape with GNU General Public License v2.0 | 5 votes |
def ImageFromStream(stream, type=wx.BITMAP_TYPE_ANY, index=-1): if wxPythonPhoenix: return wx.Image(stream=stream, type=type, index=index) else: return wx.ImageFromStream(stream=stream, type=type, index=index)
Example #19
Source File: gui.py From reading-frustum-pointnets-code with Apache License 2.0 | 5 votes |
def initimage(self, name): imageShow = wx.Image(name, wx.BITMAP_TYPE_ANY) sb = wx.StaticBitmap(self.pnl, -1, imageShow.ConvertToBitmap(), pos=(0,30), size=(600,400)) return sb
Example #20
Source File: sct_plugin.py From spinalcordtoolbox with MIT License | 5 votes |
def get_logo(self): logo_file = os.path.join(os.environ[self.SCT_DIR_ENV], self.SCT_LOGO_REL_PATH) png = wx.Image(logo_file, wx.BITMAP_TYPE_ANY).ConvertToBitmap() img_logo = wx.StaticBitmap(self, -1, png, wx.DefaultPosition, (png.GetWidth(), png.GetHeight())) return img_logo
Example #21
Source File: uicore.py From NXP-MCUBootUtility with Apache License 2.0 | 5 votes |
def showImageLayout( self , imgPath ): self.m_bitmap_bootableImage.SetBitmap(wx.Bitmap( imgPath, wx.BITMAP_TYPE_ANY ))
Example #22
Source File: gui.py From superpaper with MIT License | 5 votes |
def create_bezel_buttons(self): # load icons into bitmaps rb_png = os.path.join(RESOURCES_PATH, "icons8-merge-vertical-96.png") bb_png = os.path.join(RESOURCES_PATH, "icons8-merge-horizontal-96.png") rb_img = wx.Image(rb_png, type=wx.BITMAP_TYPE_ANY) bb_img = wx.Image(bb_png, type=wx.BITMAP_TYPE_ANY) rb_bmp = rb_img.Scale(20, 20).Resize((20, 20), (0, 0)).ConvertToBitmap() bb_bmp = bb_img.Scale(20, 20).Resize((20, 20), (0, 0)).ConvertToBitmap() # create bitmap buttons for st_bmp in self.preview_img_list: butts = [] butt_rb = wx.BitmapButton(self, bitmap=rb_bmp, name="butt_bez_r", style=wx.BORDER_NONE) butt_bb = wx.BitmapButton(self, bitmap=bb_bmp, name="butt_bez_b", style=wx.BORDER_NONE) bez_butt_color = wx.Colour(41, 47, 52) butt_rb.SetBackgroundColour(bez_butt_color) butt_bb.SetBackgroundColour(bez_butt_color) self.bez_butt_sz = butt_rb.GetSize() pos_rb, pos_bb = self.bezel_button_positions(st_bmp) butt_rb.SetPosition((pos_rb[0], pos_rb[1])) butt_bb.SetPosition((pos_bb[0], pos_bb[1])) butt_rb.Bind(wx.EVT_BUTTON, self.onBezelButton) butt_bb.Bind(wx.EVT_BUTTON, self.onBezelButton) self.bez_buttons.append( ( butt_rb, butt_bb ) ) self.show_bezel_buttons(False) self.create_bezel_popups()
Example #23
Source File: shell_frame.py From wxGlade with MIT License | 4 votes |
def __init__(self, *args, **kwds): # begin wxGlade: ShellFrame.__init__ kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_FRAME_STYLE wx.Frame.__init__(self, *args, **kwds) self.SetSize((800, 668)) self.SetTitle("wxGlade Shell ") _icon = wx.NullIcon _icon.CopyFromBitmap(wx.Bitmap("icons/wxglade128.ico", wx.BITMAP_TYPE_ANY)) self.SetIcon(_icon) self.panel = wx.Panel(self, wx.ID_ANY) sizer = wx.BoxSizer(wx.VERTICAL) grid_sizer = wx.FlexGridSizer(1, 3, 0, 0) sizer.Add(grid_sizer, 0, wx.EXPAND, 0) label = wx.StaticText(self.panel, wx.ID_ANY, "Path:") grid_sizer.Add(label, 0, wx.ALIGN_CENTER_VERTICAL, 0) self.txt_path = wx.TextCtrl(self.panel, wx.ID_ANY, "", style=wx.TE_READONLY) grid_sizer.Add(self.txt_path, 0, wx.EXPAND, 0) self.btn_assign = wx.Button(self.panel, wx.ID_ANY, "Assign to variable") grid_sizer.Add(self.btn_assign, 0, 0, 0) self.shell = wx.py.shell.Shell(self.panel, wx.ID_ANY, introText = "\nThis is the shell.\nModules 'common' and 'misc' are imported already.\n\n") # insert some variables into the shell's locals import common, misc self.shell.interp.locals["common"] = common self.shell.interp.locals["misc"] = misc sizer.Add(self.shell, 2, wx.EXPAND, 0) grid_sizer.AddGrowableCol(1) self.panel.SetSizer(sizer) self.Layout() self.Bind(wx.EVT_BUTTON, self.on_btn_assign, self.btn_assign) # end wxGlade
Example #24
Source File: gui.py From atbswp with GNU General Public License v3.0 | 4 votes |
def __init__(self, *args, **kwds): """Build the interface.""" if getattr(sys, 'frozen', False): self.path = sys._MEIPASS else: self.path = Path(__file__).parent.absolute() on_top = wx.DEFAULT_DIALOG_STYLE on_top = on_top if not settings.CONFIG.getboolean('DEFAULT', 'Always On Top') \ else on_top | wx.STAY_ON_TOP kwds["style"] = kwds.get("style", 0) | on_top wx.Dialog.__init__(self, *args, **kwds) self.panel = wx.Panel(self) self.icon = wx.Icon(os.path.join(self.path, "img", "icon.png")) self.SetIcon(self.icon) self.taskbar = TaskBarIcon(self) self.taskbar.SetIcon(self.icon, "atbswp") locale = self.__load_locale() self.app_text, self.settings_text = locale[:7], locale[7:] self.file_open_button = wx.BitmapButton(self, wx.ID_ANY, wx.Bitmap(os.path.join(self.path, "img", "file-upload.png"), wx.BITMAP_TYPE_ANY)) self.file_open_button.SetToolTip(self.app_text[0]) self.save_button = wx.BitmapButton(self, wx.ID_ANY, wx.Bitmap(os.path.join(self.path, "img", "save.png"), wx.BITMAP_TYPE_ANY)) self.save_button.SetToolTip(self.app_text[1]) self.record_button = wx.BitmapToggleButton(self, wx.ID_ANY, wx.Bitmap(os.path.join(self.path, "img", "video.png"), wx.BITMAP_TYPE_ANY)) self.record_button.SetToolTip(self.app_text[2]) self.play_button = wx.BitmapToggleButton(self, wx.ID_ANY, wx.Bitmap(os.path.join(self.path, "img", "play-circle.png"), wx.BITMAP_TYPE_ANY)) self.play_button.SetToolTip(self.app_text[3]) self.compile_button = wx.BitmapButton(self, wx.ID_ANY, wx.Bitmap(os.path.join(self.path, "img", "download.png"), wx.BITMAP_TYPE_ANY)) self.compile_button.SetToolTip(self.app_text[4]) self.settings_button = wx.BitmapButton(self, wx.ID_ANY, wx.Bitmap(os.path.join(self.path, "img", "cog.png"), wx.BITMAP_TYPE_ANY)) self.settings_button.SetToolTip(self.app_text[5]) self.help_button = wx.BitmapButton(self, wx.ID_ANY, wx.Bitmap(os.path.join(self.path, "img", "question-circle.png"), wx.BITMAP_TYPE_ANY)) self.help_button.SetToolTip(self.app_text[6]) self.__add_bindings() self.__set_properties() self.__do_layout()
Example #25
Source File: elecsus_gui.py From ElecSus with Apache License 2.0 | 4 votes |
def __init__(self,parent,title): """ Initialise main frame """ wx.Frame.__init__(self,None,title=title,size=(2000,900)) ## EXPERIMENTAL #self._mgr = aui.AuiManager() # ## notify AUI which frame to use #self._mgr.SetManagedWindow(self) #ubuntu sizing: if os.name == 'posix': font = wx.Font(9, wx.FONTFAMILY_DEFAULT, wx.NORMAL, wx.NORMAL) self.SetFont(font) # Set icons for top-left of frame, alt-tab window ... frame_icon = wx.IconBundle() try: frame_icon.AddIconFromFile(os.path.join(elecsus_dir,'images/elecsus_t_group.ico'), wx.BITMAP_TYPE_ANY) except: # new wx version frame_icon.AddIcon(os.path.join(elecsus_dir,'images/elecsus_t_group.ico'), wx.BITMAP_TYPE_ANY) self.SetIcons(frame_icon) #if the window is closed, exit self.Bind(wx.EVT_CLOSE,self.OnExit) self.panel = wx.Panel(self) self.panel.SetBackgroundColour(wx.Colour(240,240,240)) self._init_default_values() self._init_plot_defaults() self._init_menus() self._init_panels() ## redirect stdout (command line text) to status box sys.stdout = self.StatusPanel sys.stderr = self.ErrorPanel # Create initially blank set of axes #self.OnCreateAxes(self.figs[0],self.canvases[0]) ## Bind the event EVT_FIT_COMPLETE to function ## This executes in the main thread once the fitting thread ## (separate from the main thread) completes self.Bind(EVT_FIT_COMPLETE,self.OnFitCompleted)
Example #26
Source File: pyslip.py From dials with BSD 3-Clause "New" or "Revised" License | 4 votes |
def GetTile(self, x, y): """Get bitmap for tile at tile coords (x, y). x X coord of tile required (tile coordinates) y Y coord of tile required (tile coordinates) Returns bitmap object containing the tile image. Tile coordinates are measured from map top-left. If tile is in cache, read from there, else read from file & put into cache. Use LRU cache algorithm to limit memory usage. """ try: # if tile in cache, return it from there pic = self.tile_cache[(x, y)] index = self.tile_list.index((x, y)) del self.tile_list[index] except KeyError: # tile *not* in cache: get image, cache and return it img_name = os.path.join(self.tile_level_dir, "tile_%d_%d.png" % (x, y)) # load tile as not in cache if not os.path.exists(img_name): # tile not there, use 'missing tile' if not self.missing_tile: # load missing tile img_name = os.path.join(self.tile_dir, self.MissingTileFilename) img = wx.Image(img_name, wx.BITMAP_TYPE_ANY) self.missing_tile = img.ConvertToBitmap() pic = self.missing_tile else: # new tile, check if we must drop old tiles - LRU # remove oldest index at last element, then delete from dict if len(self.tile_list) > self.MaxTileList: drop_element = self.tile_list.pop() del self.tile_cache[drop_element] # we have the tile file - read into memory, cache & return img = wx.Image(img_name, wx.BITMAP_TYPE_ANY) pic = img.ConvertToBitmap() self.tile_cache[(x, y)] = pic self.tile_list.insert(0, (x, y)) return pic ###### # A layer class - encapsulates all layer data. ######
Example #27
Source File: uicore.py From NXP-MCUBootFlasher with Apache License 2.0 | 4 votes |
def __init__(self, parent): flashWin.flashWin.__init__(self, parent) self.m_bitmap_nxp.SetBitmap(wx.Bitmap( u"../img/logo_nxp.png", wx.BITMAP_TYPE_ANY )) self.exeBinRoot = os.getcwd() self.exeTopRoot = os.path.dirname(self.exeBinRoot) exeMainFile = os.path.join(self.exeTopRoot, 'src', 'main.py') if not os.path.isfile(exeMainFile): self.exeTopRoot = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) self.connectStage = uidef.kConnectStage_Rom self.connectStatusColor = None self.isUartPortSelected = None self.isUsbhidPortSelected = None self.connectedBoards = 0 self.detectedBoards = 0 self.serialPortIndex = 0 self._initStatusBar() self.languageIndex = 0 self._initLanguage() self.setLanguage() self.updateConnectStatus() self.isDymaticUsbDetection = None self._initUsbDetection() self.setUsbDetection() self.mcuDevice = None self.setTargetSetupValue() self.uartComPort = [None] self.uartBaudrate = [None] self.usbhidVid = None self.usbhidPid = None self.isUsbhidConnected = False self.usbhidToConnect = [None] * 2 self.usbDevicePath = [] self._initPortSetupValue() self._initMcuBoards() self.setMcuBoards() self.sbAppFilePath = None self.sbAppFolderPath = None self.sbAppFiles = []