当前位置: 首页>>代码示例>>Python>>正文


Python wx.BITMAP_TYPE_XPM属性代码示例

本文整理汇总了Python中wx.BITMAP_TYPE_XPM属性的典型用法代码示例。如果您正苦于以下问题:Python wx.BITMAP_TYPE_XPM属性的具体用法?Python wx.BITMAP_TYPE_XPM怎么用?Python wx.BITMAP_TYPE_XPM使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在wx的用法示例。


在下文中一共展示了wx.BITMAP_TYPE_XPM属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_xpm_bitmap

# 需要导入模块: import wx [as 别名]
# 或者: from wx import BITMAP_TYPE_XPM [as 别名]
def get_xpm_bitmap(path):
    bmp = wx.NullBitmap
    if not os.path.exists(path):
        if '.zip' in path:
            import zipfile
            archive, name = path.split('.zip', 1)
            archive += '.zip'
            if name.startswith(os.sep):
                name = name.split(os.sep, 1)[1]
            if zipfile.is_zipfile(archive):
                # extract the XPM lines...
                try:
                    data = zipfile.ZipFile(archive).read(name)
                    data = [d[1:-1] for d in _get_xpm_bitmap_re.findall(data)]
                    bmp = wx.BitmapFromXPMData(data)
                except:
                    logging.exception(_('Internal Error'))
                    bmp = wx.NullBitmap
    else:
        bmp = wx.Bitmap(path, wx.BITMAP_TYPE_XPM)
    return bmp 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:23,代码来源:misc.py

示例2: print_xpm

# 需要导入模块: import wx [as 别名]
# 或者: from wx import BITMAP_TYPE_XPM [as 别名]
def print_xpm(self, filename, *args, **kwargs):
        return self._print_image(filename, wx.BITMAP_TYPE_XPM, *args, **kwargs) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:4,代码来源:backend_wx.py

示例3: CreateBitmap

# 需要导入模块: import wx [as 别名]
# 或者: from wx import BITMAP_TYPE_XPM [as 别名]
def CreateBitmap(self, artid, client, size):
        if wx.Platform == '__WXGTK__' and artid == wx.ART_FOLDER:
            return wx.Bitmap(os.path.join(config.icons_path, 'closed_folder.xpm'), wx.BITMAP_TYPE_XPM)
        return wx.NullBitmap 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:6,代码来源:main.py

示例4: _set_icon

# 需要导入模块: import wx [as 别名]
# 或者: from wx import BITMAP_TYPE_XPM [as 别名]
def _set_icon(self):
        icon = compat.wx_EmptyIcon()
        bmp = wx.Bitmap( os.path.join(config.icons_path, "icon.xpm"), wx.BITMAP_TYPE_XPM )
        icon.CopyFromBitmap(bmp)
        self.SetIcon(icon) 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:7,代码来源:main.py

示例5: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import BITMAP_TYPE_XPM [as 别名]
def __init__(self, parent, application):
        style = wx.TR_DEFAULT_STYLE|wx.TR_HAS_VARIABLE_ROW_HEIGHT
        style |= wx.TR_EDIT_LABELS
        if wx.Platform == '__WXGTK__':    style |= wx.TR_NO_LINES|wx.TR_FULL_ROW_HIGHLIGHT
        elif wx.Platform == '__WXMAC__':  style &= ~wx.TR_ROW_LINES
        wx.TreeCtrl.__init__(self, parent, -1, style=style)
        self.cur_widget = None  # reference to the selected widget
        self.root = application
        image_list = wx.ImageList(21, 21)
        image_list.Add(wx.Bitmap(os.path.join(config.icons_path, 'application.xpm'), wx.BITMAP_TYPE_XPM))
        for w in WidgetTree.images:
            WidgetTree.images[w] = image_list.Add(misc.get_xpm_bitmap(WidgetTree.images[w]))
        self.AssignImageList(image_list)
        application.item = self.AddRoot(_('Application'), 0)
        self._SetItemData(application.item, application)
        self.skip_select = 0  # avoid an infinite loop on win32, as SelectItem fires an EVT_TREE_SEL_CHANGED event

        self.drop_target = clipboard.DropTarget(self, toplevel=True)
        self.SetDropTarget(self.drop_target)
        self._drag_ongoing = False
        self.auto_expand = True  # this control the automatic expansion of  nodes: it is set to False during xml loading
        self.Bind(wx.EVT_TREE_SEL_CHANGED, self.on_change_selection)
        self.Bind(wx.EVT_RIGHT_DOWN, self.popup_menu)
        self.Bind(wx.EVT_LEFT_DCLICK, self.on_left_dclick)
        self.Bind(wx.EVT_LEFT_DOWN, self.on_left_click) # allow direct placement of widgets
        self.Bind(wx.EVT_MENU, self.on_menu)  # for handling the selection of the first item
        self._popup_menu_widget = None  # the widget for the popup menu
        self.Bind(wx.EVT_TREE_BEGIN_DRAG, self.begin_drag)
        self.Bind(wx.EVT_LEAVE_WINDOW, self.on_leave_window)
        self.Bind(wx.EVT_MOUSE_EVENTS, self.on_mouse_events)

        self.Bind(wx.EVT_TREE_BEGIN_LABEL_EDIT, self.begin_edit_label)
        self.Bind(wx.EVT_TREE_END_LABEL_EDIT, self.end_edit_label)
        #self.Bind(wx.EVT_KEY_DOWN, misc.on_key_down_event)
        self.Bind(wx.EVT_KEY_DOWN, self.on_key_down_event)
        #self.Bind(wx.EVT_CHAR_HOOK, self.on_char)  # on wx 2.8 the event will not be delivered to the child
        self.Bind(wx.EVT_TREE_DELETE_ITEM, self.on_delete_item) 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:39,代码来源:tree.py

示例6: append_menu_item

# 需要导入模块: import wx [as 别名]
# 或者: from wx import BITMAP_TYPE_XPM [as 别名]
def append_menu_item(menu, id, text, xpm_file_or_artid=None, **kwargs): # XXX change: move id to the end of the argument list?
    if compat.IS_CLASSIC and "helpString" in kwargs:
        kwargs["help"] = kwargs["helpString"]
        del kwargs["helpString"]
    item = wx.MenuItem(menu, id, text, **kwargs)
    if xpm_file_or_artid is not None:
        path = 'msw/'  if wx.Platform == '__WXMSW__'  else  'gtk/'
        path = os.path.join(config.icons_path, path)
        bmp = None
        if not isinstance(xpm_file_or_artid, bytes) or not xpm_file_or_artid.startswith(b'wxART_'):
            try:
                bmp = _item_bitmaps[xpm_file_or_artid]
            except KeyError:
                f = os.path.join(path, xpm_file_or_artid)
                if os.path.isfile(f):
                    bmp = _item_bitmaps[xpm_file_or_artid] = wx.Bitmap(f, wx.BITMAP_TYPE_XPM)
                else:
                    bmp = None
        else:
            # xpm_file_or_artid is an id for wx.ArtProvider
            bmp = wx.ArtProvider.GetBitmap( xpm_file_or_artid, wx.ART_MENU, (16, 16) )
        if bmp is not None:
            try:
                item.SetBitmap(bmp)
            except AttributeError:
                pass
    if compat.IS_CLASSIC:
        menu.AppendItem(item)
    else:
        menu.Append(item)
    return item 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:33,代码来源:misc.py

示例7: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import BITMAP_TYPE_XPM [as 别名]
def __init__(self, num, fig):
        # On non-Windows platform, explicitly set the position - fix
        # positioning bug on some Linux platforms
        if wx.Platform == '__WXMSW__':
            pos = wx.DefaultPosition
        else:
            pos =wx.Point(20,20)
        l,b,w,h = fig.bbox.bounds
        wx.Frame.__init__(self, parent=None, id=-1, pos=pos,
                          title="Figure %d" % num)
        # Frame will be sized later by the Fit method
        DEBUG_MSG("__init__()", 1, self)
        self.num = num

        statbar = StatusBarWx(self)
        self.SetStatusBar(statbar)
        self.canvas = self.get_canvas(fig)
        self.canvas.SetInitialSize(wx.Size(fig.bbox.width, fig.bbox.height))
        self.canvas.SetFocus()
        self.sizer =wx.BoxSizer(wx.VERTICAL)
        self.sizer.Add(self.canvas, 1, wx.TOP | wx.LEFT | wx.EXPAND)
        # By adding toolbar in sizer, we are able to put it at the bottom
        # of the frame - so appearance is closer to GTK version

        self.toolbar = self._get_toolbar(statbar)

        if self.toolbar is not None:
            self.toolbar.Realize()
            # On Windows platform, default window size is incorrect, so set
            # toolbar width to figure width.
            tw, th = self.toolbar.GetSizeTuple()
            fw, fh = self.canvas.GetSizeTuple()
            # By adding toolbar in sizer, we are able to put it at the bottom
            # of the frame - so appearance is closer to GTK version.
            self.toolbar.SetSize(wx.Size(fw, th))
            self.sizer.Add(self.toolbar, 0, wx.LEFT | wx.EXPAND)
        self.SetSizer(self.sizer)
        self.Fit()

        self.canvas.SetMinSize((2, 2))

        # give the window a matplotlib icon rather than the stock one.
        # This is not currently working on Linux and is untested elsewhere.
        #icon_path = os.path.join(matplotlib.rcParams['datapath'],
        #                         'images', 'matplotlib.png')
        #icon = wx.IconFromBitmap(wx.Bitmap(icon_path))
        # for xpm type icons try:
        #icon = wx.Icon(icon_path, wx.BITMAP_TYPE_XPM)
        #self.SetIcon(icon)

        self.figmgr = FigureManagerWx(self.canvas, num, self)

        bind(self, wx.EVT_CLOSE, self._onClose) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:55,代码来源:backend_wx.py

示例8: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import BITMAP_TYPE_XPM [as 别名]
def __init__(self, num, fig):
        # On non-Windows platform, explicitly set the position - fix
        # positioning bug on some Linux platforms
        if wx.Platform == '__WXMSW__':
            pos = wx.DefaultPosition
        else:
            pos = wx.Point(20, 20)
        l, b, w, h = fig.bbox.bounds
        wx.Frame.__init__(self, parent=None, id=-1, pos=pos,
                          title="Figure %d" % num)
        # Frame will be sized later by the Fit method
        DEBUG_MSG("__init__()", 1, self)
        self.num = num

        statbar = StatusBarWx(self)
        self.SetStatusBar(statbar)
        self.canvas = self.get_canvas(fig)
        self.canvas.SetInitialSize(wx.Size(fig.bbox.width, fig.bbox.height))
        self.canvas.SetFocus()
        self.sizer = wx.BoxSizer(wx.VERTICAL)
        self.sizer.Add(self.canvas, 1, wx.TOP | wx.LEFT | wx.EXPAND)
        # By adding toolbar in sizer, we are able to put it at the bottom
        # of the frame - so appearance is closer to GTK version

        self.toolbar = self._get_toolbar(statbar)

        if self.toolbar is not None:
            self.toolbar.Realize()
            # On Windows platform, default window size is incorrect, so set
            # toolbar width to figure width.
            if wxc.is_phoenix:
                tw, th = self.toolbar.GetSize()
                fw, fh = self.canvas.GetSize()
            else:
                tw, th = self.toolbar.GetSizeTuple()
                fw, fh = self.canvas.GetSizeTuple()
            # By adding toolbar in sizer, we are able to put it at the bottom
            # of the frame - so appearance is closer to GTK version.
            self.toolbar.SetSize(wx.Size(fw, th))
            self.sizer.Add(self.toolbar, 0, wx.LEFT | wx.EXPAND)
        self.SetSizer(self.sizer)
        self.Fit()

        self.canvas.SetMinSize((2, 2))

        # give the window a matplotlib icon rather than the stock one.
        # This is not currently working on Linux and is untested elsewhere.
        # icon_path = os.path.join(matplotlib.rcParams['datapath'],
        #                         'images', 'matplotlib.png')
        # icon = wx.IconFromBitmap(wx.Bitmap(icon_path))
        #  for xpm type icons try:
        # icon = wx.Icon(icon_path, wx.BITMAP_TYPE_XPM)
        #  self.SetIcon(icon)

        self.figmgr = FigureManagerWx(self.canvas, num, self)

        self.Bind(wx.EVT_CLOSE, self._onClose) 
开发者ID:alvarobartt,项目名称:twitter-stock-recommendation,代码行数:59,代码来源:backend_wx.py


注:本文中的wx.BITMAP_TYPE_XPM属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。