當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。