本文整理汇总了Python中wx.BITMAP_TYPE_ANY属性的典型用法代码示例。如果您正苦于以下问题:Python wx.BITMAP_TYPE_ANY属性的具体用法?Python wx.BITMAP_TYPE_ANY怎么用?Python wx.BITMAP_TYPE_ANY使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类wx
的用法示例。
在下文中一共展示了wx.BITMAP_TYPE_ANY属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_thumb_bmp
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BITMAP_TYPE_ANY [as 别名]
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
#
示例2: create_thumb_bmp
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BITMAP_TYPE_ANY [as 别名]
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
示例3: updateConnectStatus
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BITMAP_TYPE_ANY [as 别名]
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
示例4: get_preview_obj_bitmap
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BITMAP_TYPE_ANY [as 别名]
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)
示例5: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BITMAP_TYPE_ANY [as 别名]
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()
示例6: graph_caps
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BITMAP_TYPE_ANY [as 别名]
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
示例7: __set_properties
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BITMAP_TYPE_ANY [as 别名]
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
示例8: __set_properties
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BITMAP_TYPE_ANY [as 别名]
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
示例9: __set_properties
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BITMAP_TYPE_ANY [as 别名]
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
示例10: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BITMAP_TYPE_ANY [as 别名]
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)
示例11: create_bezel_buttons
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BITMAP_TYPE_ANY [as 别名]
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()
示例12: showImageLayout
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BITMAP_TYPE_ANY [as 别名]
def showImageLayout( self , imgPath ):
self.m_bitmap_bootableImage.SetBitmap(wx.Bitmap( imgPath, wx.BITMAP_TYPE_ANY ))
示例13: get_logo
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BITMAP_TYPE_ANY [as 别名]
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
示例14: initimage
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BITMAP_TYPE_ANY [as 别名]
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
示例15: ImageFromStream
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BITMAP_TYPE_ANY [as 别名]
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)