本文整理汇总了Python中wx.StaticBitmap方法的典型用法代码示例。如果您正苦于以下问题:Python wx.StaticBitmap方法的具体用法?Python wx.StaticBitmap怎么用?Python wx.StaticBitmap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wx
的用法示例。
在下文中一共展示了wx.StaticBitmap方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: launchFileDialog
# 需要导入模块: import wx [as 别名]
# 或者: from wx import StaticBitmap [as 别名]
def launchFileDialog(self, evt):
# defining wildcard for suppported picture formats
wildcard = "JPEG (*.jpg)|*.jpg|" \
"PNG (*.png)|*.png|" \
"GIF (*.gif)|*.gif"
# defining the dialog object
dialog = wx.FileDialog(self, message="Select Picture", defaultDir=os.getcwd(), defaultFile="",
wildcard=wildcard,
style=wx.FD_OPEN | wx.FD_MULTIPLE | wx.FD_CHANGE_DIR | wx.FD_FILE_MUST_EXIST | wx.FD_PREVIEW)
# Function to retrieve file dialog response and return the full path of the first image (it is a multi-file selection dialog)
if dialog.ShowModal() == wx.ID_OK:
self.magic_collection[1].SetValue(
"You have selected a Picture. It will now be processed!, Please wait! \nLoading.....")
paths = dialog.GetPaths()
# This adds the selected picture to the Right region. Right region object is retrieved from UI object array
modification_bitmap1 = wx.Bitmap(paths[0])
modification_image1 = modification_bitmap1.ConvertToImage()
modification_image1 = modification_image1.Scale(650, 490, wx.IMAGE_QUALITY_HIGH)
modification_bitmap2 = modification_image1.ConvertToBitmap()
report_bitmap = wx.StaticBitmap(self.magic_collection[0], -1, modification_bitmap2, (0, 20))
self.processPicture(paths[0],
"PROGRAM_INSTALL_FULLPATH\\resnet50_weights_tf_dim_ordering_tf_kernels.h5",
"PROGRAM_INSTALL_FULLPATH\\imagenet_class_index.json")
示例2: launchFileDialog
# 需要导入模块: import wx [as 别名]
# 或者: from wx import StaticBitmap [as 别名]
def launchFileDialog(self, evt):
# defining wildcard for suppported picture formats
wildcard = "JPEG (*.jpg)|*.jpg|" \
"PNG (*.png)|*.png|" \
"GIF (*.gif)|*.gif"
# defining the dialog object
dialog = wx.FileDialog(self, message="Select Picture", defaultDir=os.getcwd(), defaultFile="",
wildcard=wildcard,
style=wx.FD_OPEN | wx.FD_MULTIPLE | wx.FD_CHANGE_DIR | wx.FD_FILE_MUST_EXIST | wx.FD_PREVIEW)
# Function to retrieve file dialog response and return the full path of the first image (it is a multi-file selection dialog)
if dialog.ShowModal() == wx.ID_OK:
self.magic_collection[1].SetValue(
"You have selected a Picture. It will now be processed!, Please wait! \nLoading.....")
paths = dialog.GetPaths()
# This adds the selected picture to the Right region. Right region object is retrieved from UI object array
modification_bitmap1 = wx.Bitmap(paths[0])
modification_image1 = modification_bitmap1.ConvertToImage()
modification_image1 = modification_image1.Scale(650, 490, wx.IMAGE_QUALITY_HIGH)
modification_bitmap2 = modification_image1.ConvertToBitmap()
report_bitmap = wx.StaticBitmap(self.magic_collection[0], -1, modification_bitmap2, (0, 20))
self.processPicture(paths[0],
"PROGRAM_INSTALL_FULLPATH\\DenseNet-BC-121-32.h5",
"PROGRAM_INSTALL_FULLPATH\\imagenet_class_index.json")
示例3: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import StaticBitmap [as 别名]
def __init__(self, parent):
# TODO: try to use MessageBox instead, as they already include buttons, icons, etc.
wx.Dialog.__init__(self, parent, title="SCT Processing")
self.SetSize((300, 120))
vbox = wx.BoxSizer(wx.VERTICAL)
lbldesc = wx.StaticText(self, id=wx.ID_ANY, label="Processing, please wait...")
vbox.Add(lbldesc, 0, wx.ALIGN_LEFT | wx.ALL, 10)
btns = self.CreateSeparatedButtonSizer(wx.CANCEL)
vbox.Add(btns, 0, wx.ALIGN_LEFT | wx.ALL, 5)
hbox = wx.BoxSizer(wx.HORIZONTAL)
# TODO: use a nicer image, showing two gears (similar to ID_EXECUTE)
save_ico = wx.ArtProvider.GetBitmap(wx.ART_INFORMATION, wx.ART_TOOLBAR, (50, 50))
img_info = wx.StaticBitmap(self, -1, save_ico, wx.DefaultPosition, (save_ico.GetWidth(), save_ico.GetHeight()))
hbox.Add(img_info, 0, wx.ALL, 10)
hbox.Add(vbox, 0, wx.ALL, 0)
self.SetSizer(hbox)
self.Centre()
self.CenterOnParent()
# TODO: retrieve action from the cancel button
示例4: launchFileDialog
# 需要导入模块: import wx [as 别名]
# 或者: from wx import StaticBitmap [as 别名]
def launchFileDialog(self, evt):
# defining wildcard for suppported picture formats
wildcard = "JPEG (*.jpg)|*.jpg|" \
"PNG (*.png)|*.png|" \
"GIF (*.gif)|*.gif"
# defining the dialog object
dialog = wx.FileDialog(self, message="Select Picture", defaultDir=os.getcwd(), defaultFile="",
wildcard=wildcard,
style=wx.FD_OPEN | wx.FD_MULTIPLE | wx.FD_CHANGE_DIR | wx.FD_FILE_MUST_EXIST | wx.FD_PREVIEW)
# Function to retrieve file dialog response and return the full path of the first image (it is a multi-file selection dialog)
if dialog.ShowModal() == wx.ID_OK:
self.magic_collection[1].SetValue(
"You have selected a Picture. It will now be processed!, Please wait! \nLoading.....")
paths = dialog.GetPaths()
# This adds the selected picture to the Right region. Right region object is retrieved from UI object array
modification_bitmap1 = wx.Bitmap(paths[0])
modification_image1 = modification_bitmap1.ConvertToImage()
modification_image1 = modification_image1.Scale(650, 490, wx.IMAGE_QUALITY_HIGH)
modification_bitmap2 = modification_image1.ConvertToBitmap()
report_bitmap = wx.StaticBitmap(self.magic_collection[0], -1, modification_bitmap2, (0, 20))
self.processPicture(paths[0],
"PROGRAM_INSTALL_FULLPATH\\squeezenet_weights_tf_dim_ordering_tf_kernels.h5",
"PROGRAM_INSTALL_FULLPATH\\imagenet_class_index.json")
示例5: launchFileDialog
# 需要导入模块: import wx [as 别名]
# 或者: from wx import StaticBitmap [as 别名]
def launchFileDialog(self, evt):
# defining wildcard for suppported picture formats
wildcard = "JPEG (*.jpg)|*.jpg|" \
"PNG (*.png)|*.png|" \
"GIF (*.gif)|*.gif"
# defining the dialog object
dialog = wx.FileDialog(self, message="Select Picture", defaultDir=os.getcwd(), defaultFile="",
wildcard=wildcard,
style=wx.FD_OPEN | wx.FD_MULTIPLE | wx.FD_CHANGE_DIR | wx.FD_FILE_MUST_EXIST | wx.FD_PREVIEW)
# Function to retrieve file dialog response and return the full path of the first image (it is a multi-file selection dialog)
if dialog.ShowModal() == wx.ID_OK:
self.magic_collection[1].SetValue(
"You have selected a Picture. It will now be processed!, Please wait! \nLoading.....")
paths = dialog.GetPaths()
# This adds the selected picture to the Right region. Right region object is retrieved from UI object array
modification_bitmap1 = wx.Bitmap(paths[0])
modification_image1 = modification_bitmap1.ConvertToImage()
modification_image1 = modification_image1.Scale(650, 490, wx.IMAGE_QUALITY_HIGH)
modification_bitmap2 = modification_image1.ConvertToBitmap()
report_bitmap = wx.StaticBitmap(self.magic_collection[0], -1, modification_bitmap2, (0, 20))
self.processPicture(paths[0],
"PROGRAM_INSTALL_FULLPATH\\inception_v3_weights_tf_dim_ordering_tf_kernels.h5",
"PROGRAM_INSTALL_FULLPATH\\imagenet_class_index.json")
示例6: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import StaticBitmap [as 别名]
def __init__(self, parent, gui_size):
h = gui_size[0]
w = gui_size[1]
wx.Panel.__init__(self, parent, -1, style=wx.SUNKEN_BORDER, size=(h, w))
## design the panel
sizer = wx.GridBagSizer(10, 7)
# Add image of DLC
icon = wx.StaticBitmap(self, bitmap=wx.Bitmap(dlc))
sizer.Add(icon, pos=(0, 0), span=(0, 8), flag=wx.EXPAND | wx.BOTTOM, border=10)
line = wx.StaticLine(self)
sizer.Add(line, pos=(1, 0), span=(1, 8), flag=wx.EXPAND | wx.BOTTOM, border=10)
# if editing this text make sure you add the '\n' to get the new line. The sizer is unable to format lines correctly.
description = "DeepLabCut™ is an open source tool for markerless\npose estimation of user-defined body parts with deep learning.\nA. and M.W. Mathis Labs | http://www.deeplabcut.org\n \nWelcome to the DeepLabCut Project Manager GUI!\nTo get started, please click on the 'Manage Project'\n tab to create or load an existing project. \n "
self.proj_name = wx.StaticText(self, label=description, style=wx.ALIGN_CENTRE)
sizer.Add(self.proj_name, pos=(2, 3), border=10)
sizer.AddGrowableCol(2)
self.SetSizer(sizer)
sizer.Fit(self)
示例7: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import StaticBitmap [as 别名]
def __init__(self, parent, wxid=wx.ID_ANY):
images = {}
tips = {}
a = wx.GetApp()
for k in self.states.keys():
i = a.theme_library.get(('statuslight', self.states[k][0]))
b = wx.BitmapFromImage(i)
images[k] = b
_StatusLight.__init__(self)
wx.Panel.__init__(self, parent, id=wxid, style=wx.NO_BORDER)
self.SetSize(wx.Size(24,24))
self.bitmap = wx.StaticBitmap(self, wx.ID_ANY)
self.images = images
self.tips = tips
self.Fit()
self.change_state()
示例8: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import StaticBitmap [as 别名]
def __init__(self, parent, label, title="", mesg="", imageString=None):
self.title = title
self.mesg = mesg
self.imageString = imageString
wx.Window.__init__(self, parent, -1)
self.button = wx.Button(self, -1, label)
self.imageBox = wx.StaticBitmap(
self, -1, size=(10, 10), style=wx.SUNKEN_BORDER
)
self.SetValue(imageString)
sizer = wx.BoxSizer(wx.HORIZONTAL)
sizer.Add(self.button, 0, wx.RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
sizer.Add(self.imageBox, 1, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL)
self.SetSizer(sizer)
self.Bind(wx.EVT_BUTTON, self.OnButton)
self.Bind(wx.EVT_SIZE, self.OnSize)
self.Bind(wx.EVT_SET_FOCUS, self.OnSetFocus)
self.Layout()
示例9: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import StaticBitmap [as 别名]
def __init__(self, size=(-1, -1), pic_path=None, display=0):
wx.Frame.__init__(
self,
None,
-1,
"ShowPictureFrame",
style=wx.NO_BORDER | wx.FRAME_NO_TASKBAR #| wx.STAY_ON_TOP
)
self.SetBackgroundColour(wx.Colour(0, 0, 0))
self.Bind(wx.EVT_LEFT_DCLICK, self.LeftDblClick)
self.Bind(wx.EVT_CLOSE, self.OnClose)
bitmap = wx.EmptyBitmap(1, 1)
self.staticBitmap = wx.StaticBitmap(self, -1, bitmap)
self.staticBitmap.Bind(wx.EVT_LEFT_DCLICK, self.LeftDblClick)
self.staticBitmap.Bind(wx.EVT_MOTION, self.ShowCursor)
self.timer = Timer(2.0, self.HideCursor)
示例10: resize_bitmap
# 需要导入模块: import wx [as 别名]
# 或者: from wx import StaticBitmap [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))
示例11: draw_image
# 需要导入模块: import wx [as 别名]
# 或者: from wx import StaticBitmap [as 别名]
def draw_image(self):
if not self.result_image or not self.frame:
return
wx.StaticBitmap(self.frame, wx.ID_ANY, self.result_image,
(0, 0), self.size)
示例12: draw_displays
# 需要导入模块: import wx [as 别名]
# 或者: from wx import StaticBitmap [as 别名]
def draw_displays(self, use_ppi_px = False, use_multi_image = False):
work_sz = self.GetSize()
# draw canvas
bmp_canv = wx.Bitmap.FromRGBA(self.dtop_canvas_relsz[0], self.dtop_canvas_relsz[1], red=0, green=0, blue=0, alpha=255)
if not self.preview_img_list:
# preview StaticBitmaps don't exist yet
self.bmp_list.append(bmp_canv)
self.st_bmp_canvas = wx.StaticBitmap(self, wx.ID_ANY, bmp_canv)
self.st_bmp_canvas.SetPosition(self.dtop_canvas_pos)
self.st_bmp_canvas.Hide()
# draw monitor previews
for disp in self.display_rel_sizes:
size = disp[0]
offs = disp[1]
bmp = wx.Bitmap.FromRGBA(size[0], size[1], red=0, green=0, blue=0, alpha=255)
self.bmp_list.append(bmp)
st_bmp = wx.StaticBitmap(self, wx.ID_ANY, bmp)
st_bmp.Hide()
# st_bmp.SetScaleMode(wx.Scale_AspectFill) # New in wxpython 4.1
st_bmp.SetPosition(offs)
self.preview_img_list.append(st_bmp)
else:
# previews exist and should be blanked
self.current_preview_images = [] # drop chached image list
self.st_bmp_canvas.SetBitmap(bmp_canv)
self.st_bmp_canvas.SetPosition(self.dtop_canvas_pos)
# self.st_bmp_canvas.Hide()
# blank monitor previews
for disp, st_bmp in zip(self.display_rel_sizes, self.preview_img_list):
size = disp[0]
offs = disp[1]
bmp = wx.Bitmap.FromRGBA(size[0], size[1], red=0, green=0, blue=0, alpha=255)
st_bmp.SetBitmap(bmp)
st_bmp.SetPosition(offs)
# st_bmp.Hide()
self.draw_monitor_numbers(use_ppi_px)
self.Refresh()
示例13: bezel_button_positions
# 需要导入模块: import wx [as 别名]
# 或者: from wx import StaticBitmap [as 别名]
def bezel_button_positions(self, st_bmp):
"""Return the mid points on the screen of the right and bottom edges
of the given StaticBitmap."""
sz = st_bmp.GetSize()
pos = st_bmp.GetPosition()
bsz = self.bez_butt_sz
pos_rb = (sz[0] + pos[0] - bsz[0]/2, sz[1]/2 + pos[1] - bsz[1]/2)
pos_bb = (sz[0]/2 + pos[0] - bsz[0]/2, sz[1] + pos[1] - bsz[1]/2)
return [pos_rb, pos_bb]
示例14: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import StaticBitmap [as 别名]
def __init__(self, parent, title="Color Recognizer 2"):
wx.Frame.__init__(self, parent, size=(800, 600), style=wx.DEFAULT_DIALOG_STYLE | wx.MINIMIZE_BOX)
self.imgSizer = (800, 600)
self.pnl = wx.Panel(self)
self.vbox = wx.BoxSizer(wx.VERTICAL)
self.image = wx.Image(self.imgSizer[0],self.imgSizer[1])
self.imageBit = wx.Bitmap(self.image)
self.staticBit = wx.StaticBitmap(self.pnl, wx.ID_ANY, self.imageBit)
self.vbox.Add(self.staticBit)
self.capture = cv2.VideoCapture(0)
ret, self.frame = self.capture.read()
if ret:
self.height, self.width = self.frame.shape[:2]
self.bmp = wx.Bitmap.FromBuffer(self.width, self.height, self.frame)
self.timex = wx.Timer(self)
self.timex.Start(1000./24)
self.Bind(wx.EVT_TIMER, self.redraw)
self.SetSize(self.imgSizer)
else:
print("Error no webcam image")
self.pnl.SetSizer(self.vbox)
self.vbox.Fit(self)
# Create buttons
btn_black = wx.Button(self, -1, "Black", pos=(10,20))
btn_white = wx.Button(self, -1, "White", pos=(110,20))
btn_red = wx.Button(self, -1, "Red", pos=(210,20))
btn_green = wx.Button(self, -1, "Green", pos=(310,20))
btn_blue = wx.Button(self, -1, "Blue", pos=(410,20))
btn_orange = wx.Button(self, -1, "Orange", pos=(510,20))
btn_yellow = wx.Button(self, -1, "Yellow", pos=(610,20))
btn_purple = wx.Button(self, -1, "Purple", pos=(710,20))
self.Bind(wx.EVT_BUTTON, self.OnClick)
# Create statusbar
self.statusbar = self.CreateStatusBar(1)
self.statusbar.SetStatusText('None')
self.Show()
示例15: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import StaticBitmap [as 别名]
def __init__(self, *args, **kwds):
# begin wxGlade: webcamPreviewDialog.__init__
kwds["style"] = wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER | wx.THICK_FRAME
wx.Dialog.__init__(self, *args, **kwds)
self.panel_1 = wx.ScrolledWindow(self, wx.ID_ANY, style=wx.TAB_TRAVERSAL)
self.previewbitmap = wx.StaticBitmap(self.panel_1, wx.ID_ANY, wx.NullBitmap)
self.previewokbutton = wx.Button(self, wx.ID_OK, "")
self.__set_properties()
self.__do_layout()
# end wxGlade