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


Python wx.BitmapFromImage方法代码示例

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


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

示例1: add_image

# 需要导入模块: import wx [as 别名]
# 或者: from wx import BitmapFromImage [as 别名]
def add_image(self, image):
        b = wx.BitmapFromImage(image)
        if not b.Ok():
            raise Exception("The image (%s) is not valid." % image)

        if (sys.platform == "darwin" and
            (b.GetWidth(), b.GetHeight()) == (self.icon_size, self.icon_size)):
            return self.il.Add(b)
        
        b2 = wx.EmptyBitmap(self.icon_size, self.icon_size)
        dc = wx.MemoryDC()
        dc.SelectObject(b2)
        dc.SetBackgroundMode(wx.TRANSPARENT)
        dc.Clear()
        x = (b2.GetWidth() - b.GetWidth()) / 2
        y = (b2.GetHeight() - b.GetHeight()) / 2
        dc.DrawBitmap(b, x, y, True)
        dc.SelectObject(wx.NullBitmap)
        b2.SetMask(wx.Mask(b2, (255, 255, 255)))

        return self.il.Add(b2)

    # Arrow drawing 
开发者ID:kenorb-contrib,项目名称:BitTorrent,代码行数:25,代码来源:ListCtrl.py

示例2: SetValue

# 需要导入模块: import wx [as 别名]
# 或者: from wx import BitmapFromImage [as 别名]
def SetValue(self, imageString):
        self.imageString = imageString
        if imageString:
            stream = StringIO(b64decode(imageString))
            image = wx.ImageFromStream(stream)
            stream.close()
            boxWidth, boxHeight = (10, 10)
            width, height = image.GetSize()
            if width > boxWidth:
                height *= 1.0 * boxWidth / width
                width = boxWidth
            if height > boxHeight:
                width *= 1.0 * boxHeight / height
                height = boxHeight
            image.Rescale(width, height)
            bmp = wx.BitmapFromImage(image)
            self.imageBox.SetBitmap(bmp)
            self.imageBox.SetSize((30, 30)) 
开发者ID:EventGhost,项目名称:EventGhost,代码行数:20,代码来源:ImagePicker.py

示例3: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import BitmapFromImage [as 别名]
def __init__(self, parent, id, evtList, ix, plugin):
        width = 205
        wx.ListCtrl.__init__(self, parent, id, style=wx.LC_REPORT |
            wx.LC_NO_HEADER | wx.LC_SINGLE_SEL, size = (width, -1))
        self.parent = parent
        self.id = id
        self.evtList = evtList
        self.ix = ix
        self.plugin = plugin
        self.sel = -1
        self.il = wx.ImageList(16, 16)
        self.il.Add(wx.BitmapFromImage(wx.Image(join(eg.imagesDir, "event.png"), wx.BITMAP_TYPE_PNG)))
        self.SetImageList(self.il, wx.IMAGE_LIST_SMALL)
        self.InsertColumn(0, '')
        self.SetColumnWidth(0, width - 5 - SYS_VSCROLL_X)
        self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnSelect)
        self.Bind(wx.EVT_SET_FOCUS, self.OnChange)
        self.Bind(wx.EVT_LIST_INSERT_ITEM, self.OnChange)
        self.Bind(wx.EVT_LIST_ITEM_DESELECTED, self.OnChange)
        self.Bind(wx.EVT_LIST_ITEM_RIGHT_CLICK, self.OnRightClick)
        self.SetToolTipString(self.plugin.text.toolTip) 
开发者ID:EventGhost,项目名称:EventGhost,代码行数:23,代码来源:__init__.py

示例4: updateUI

# 需要导入模块: import wx [as 别名]
# 或者: from wx import BitmapFromImage [as 别名]
def updateUI(self, capsdir):
        print("---UPDATING USER INTERFACE ---")
        capsdir = self.capsfolder_box.GetValue()
        fframe = self.firstframe_box.GetValue()
        lframe = self.lastframe_box.GetValue()
        if fframe == '':
            fframe = 0
        if lframe == '':
            lframe = len(cap_files) - 1
        last_pic  = str(capsdir + cap_files[lframe])
        first_pic = str(capsdir + cap_files[fframe])
        self.firstframe_box.SetValue(str(fframe))
        self.lastframe_box.SetValue(str(lframe))
        self.updatelastpic(lframe)
        self.updatefirstpic(fframe)
     #Cap graph
        cap_size_graph = self.graph_caps(cap_files, graphdir)
        scale_size_graph = first_pic = self.scale_pic(cap_size_graph, 300)
        try:
            self.cap_thumb.SetBitmap(wx.BitmapFromImage(scale_size_graph))
        except:
            print("no graph to work with, sorry") 
开发者ID:Pragmatismo,项目名称:Pigrow,代码行数:24,代码来源:make_timelapse.py

示例5: resize_bitmap

# 需要导入模块: import wx [as 别名]
# 或者: from wx import BitmapFromImage [as 别名]
def resize_bitmap(parent, _bitmap, target_height):
  '''
  Resizes a bitmap to a height of 89 pixels (the
  size of the top panel), while keeping aspect ratio
  in tact
  '''
  image = wx.ImageFromBitmap(_bitmap)
  _width, _height = image.GetSize()
  if _height < target_height:
    return wx.StaticBitmap(parent, -1, wx.BitmapFromImage(image))
  ratio = float(_width) / _height
  image = image.Scale(target_height * ratio, target_height, wx.IMAGE_QUALITY_HIGH)
  return wx.StaticBitmap(parent, -1, wx.BitmapFromImage(image)) 
开发者ID:ME-ICA,项目名称:me-ica,代码行数:15,代码来源:imageutil.py

示例6: GetMondrianBitmap

# 需要导入模块: import wx [as 别名]
# 或者: from wx import BitmapFromImage [as 别名]
def GetMondrianBitmap():
    stream = GetMondrianStream()
    image = wx.ImageFromStream(stream)
    return wx.BitmapFromImage(image) 
开发者ID:taojy123,项目名称:KeymouseGo,代码行数:6,代码来源:Frame1.py

示例7: getIcon

# 需要导入模块: import wx [as 别名]
# 或者: from wx import BitmapFromImage [as 别名]
def getIcon( data ):
    """Return the data from the resource as a wxIcon"""
    import cStringIO
    stream = cStringIO.StringIO(data)
    image = wx.ImageFromStream(stream)
    icon = wx.EmptyIcon()
    icon.CopyFromBitmap(wx.BitmapFromImage(image))
    return icon 
开发者ID:lrq3000,项目名称:pyFileFixity,代码行数:10,代码来源:runsnake.py

示例8: bitmapFromImage

# 需要导入模块: import wx [as 别名]
# 或者: from wx import BitmapFromImage [as 别名]
def bitmapFromImage(image):
    if isLatestVersion:
        return wx.Bitmap(image)
    else:
        return wx.BitmapFromImage(image) 
开发者ID:chriskiehl,项目名称:Gooey,代码行数:7,代码来源:three_to_four.py

示例9: BitmapFromImage

# 需要导入模块: import wx [as 别名]
# 或者: from wx import BitmapFromImage [as 别名]
def BitmapFromImage(image, depth=-1):
    if wxPythonPhoenix:
        return wx.Bitmap(img=image, depth=depth)
    else:
        return wx.BitmapFromImage(image, depth=depth) 
开发者ID:tangible-landscape,项目名称:grass-tangible-landscape,代码行数:7,代码来源:wxwrap.py

示例10: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import BitmapFromImage [as 别名]
def __init__(self, parent, ops=[], *a, **k):
        size = wx.the_app.config['toolbar_size']
        self.size = size

        style = self.default_style
        config = wx.the_app.config
        if config['toolbar_text']:
            style |= wx.TB_TEXT

        wx.ToolBar.__init__(self, parent, style=style, **k)

        self.SetToolBitmapSize((size,size))

        while ops:
            opset = ops.pop(0)
            for e in opset:
                if issubclass(type(e.image), (str,unicode)):
                    bmp = wx.ArtProvider.GetBitmap(e.image, wx.ART_TOOLBAR, (size,size))
                elif type(e.image) is tuple:
                    i = wx.the_app.theme_library.get(e.image, self.size)
                    bmp = wx.BitmapFromImage(i)
                    assert bmp.Ok(), "The image (%s) is not valid." % i
                self.AddLabelTool(e.id, e.label, bmp, shortHelp=e.shorthelp)

            if len(ops):
                self.AddSeparator()

        self.Realize() 
开发者ID:kenorb-contrib,项目名称:BitTorrent,代码行数:30,代码来源:DownloadManager.py

示例11: select_torrent

# 需要导入模块: import wx [as 别名]
# 或者: from wx import BitmapFromImage [as 别名]
def select_torrent(self, *a):
        image = wx.the_app.theme_library.get(('add',), 32)
        d = OpenDialog(self.main_window,
                       title=_("Open Path"),
                       bitmap=wx.BitmapFromImage(image),
                       browse=self.select_torrent_file,
                       history=self.open_dialog_history)
        if d.ShowModal() == wx.ID_OK:
            path = d.GetValue()
            self.open_dialog_history.append(path)
            df = self.open_torrent_arg_with_callbacks(path) 
开发者ID:kenorb-contrib,项目名称:BitTorrent,代码行数:13,代码来源:DownloadManager.py

示例12: getAutoRefreshBitmap

# 需要导入模块: import wx [as 别名]
# 或者: from wx import BitmapFromImage [as 别名]
def getAutoRefreshBitmap():
    return BitmapFromImage(getAutoRefreshImage()) 
开发者ID:andreas-p,项目名称:admin4,代码行数:4,代码来源:images.py

示例13: getIconBitmap

# 需要导入模块: import wx [as 别名]
# 或者: from wx import BitmapFromImage [as 别名]
def getIconBitmap():
    return BitmapFromImage(getIconImage()) 
开发者ID:andreas-p,项目名称:admin4,代码行数:4,代码来源:images.py

示例14: getLocateBitmap

# 需要导入模块: import wx [as 别名]
# 或者: from wx import BitmapFromImage [as 别名]
def getLocateBitmap():
    return BitmapFromImage(getLocateImage()) 
开发者ID:andreas-p,项目名称:admin4,代码行数:4,代码来源:images.py

示例15: getLocateArmedBitmap

# 需要导入模块: import wx [as 别名]
# 或者: from wx import BitmapFromImage [as 别名]
def getLocateArmedBitmap():
    return BitmapFromImage(getLocateArmedImage()) 
开发者ID:andreas-p,项目名称:admin4,代码行数:4,代码来源:images.py


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