本文整理汇总了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
示例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))
示例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)
示例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")
示例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))
示例6: GetMondrianBitmap
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BitmapFromImage [as 别名]
def GetMondrianBitmap():
stream = GetMondrianStream()
image = wx.ImageFromStream(stream)
return wx.BitmapFromImage(image)
示例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
示例8: bitmapFromImage
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BitmapFromImage [as 别名]
def bitmapFromImage(image):
if isLatestVersion:
return wx.Bitmap(image)
else:
return wx.BitmapFromImage(image)
示例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)
示例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()
示例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)
示例12: getAutoRefreshBitmap
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BitmapFromImage [as 别名]
def getAutoRefreshBitmap():
return BitmapFromImage(getAutoRefreshImage())
示例13: getIconBitmap
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BitmapFromImage [as 别名]
def getIconBitmap():
return BitmapFromImage(getIconImage())
示例14: getLocateBitmap
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BitmapFromImage [as 别名]
def getLocateBitmap():
return BitmapFromImage(getLocateImage())
示例15: getLocateArmedBitmap
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BitmapFromImage [as 别名]
def getLocateArmedBitmap():
return BitmapFromImage(getLocateArmedImage())