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


Python wx.Bitmap方法代码示例

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


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

示例1: on_color_change

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Bitmap [as 别名]
def on_color_change(self, event):
        """
        Change the plot colors.

        This is done by updating self.gradient and calling self.draw_scale()
        """
        if event['low'] is not None:
            self.low_color = event['low']
        if event['high'] is not None:
            self.high_color = event['high']
        self.gradient = wm_utils.LinearGradient(self.low_color,
                                                self.high_color)

#        self._clear_scale()
        self.hbox.Remove(0)
        self.hbox.Add((self.dc_w, self.dc_h))
#        self.mdc.SelectObject(wx.EmptyBitmap(self.dc_w, self.dc_h))
        self.mdc.SelectObject(wx.Bitmap(self.dc_w, self.dc_h))

        self.draw_scale() 
开发者ID:dougthor42,项目名称:wafer_map,代码行数:22,代码来源:wm_legend.py

示例2: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Bitmap [as 别名]
def __init__(self, parent, id=-1, colour=wx.BLACK,
                         pos=wx.DefaultPosition, size=wx.DefaultSize,
                         style = CLRP_DEFAULT_STYLE,
                         validator = wx.DefaultValidator,
                         name = "colourpickerwidget"):
                
                wx.BitmapButton.__init__(self, parent, id, wx.Bitmap(1,1), 
                                         pos, size, style, validator, name)
                self.SetColour(colour)
                self.InvalidateBestSize()
                self.SetInitialSize(size)
                self.Bind(wx.EVT_BUTTON, self.OnButtonClick)
                
                global _colourData
                if _colourData is None:
                    _colourData = wx.ColourData()
                    _colourData.SetChooseFull(True)
                    grey = 0
                    for i in range(16):
                        c = wx.Colour(grey, grey, grey)
                        _colourData.SetCustomColour(i, c)
                        grey += 16 
开发者ID:dougthor42,项目名称:wafer_map,代码行数:24,代码来源:core.py

示例3: _load_bitmap

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Bitmap [as 别名]
def _load_bitmap(filename):
    """
    Load a bitmap file from the backends/images subdirectory in which the
    matplotlib library is installed. The filename parameter should not
    contain any path information as this is determined automatically.

    Returns a wx.Bitmap object
    """

    basedir = os.path.join(rcParams['datapath'],'images')

    bmpFilename = os.path.normpath(os.path.join(basedir, filename))
    if not os.path.exists(bmpFilename):
        raise IOError('Could not find bitmap file "%s"; dying'%bmpFilename)

    bmp = wx.Bitmap(bmpFilename)
    return bmp 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:19,代码来源:backend_wx.py

示例4: draw_image

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Bitmap [as 别名]
def draw_image(self, gc, x, y, im):
        bbox = gc.get_clip_rectangle()
        if bbox is not None:
            l, b, w, h = bbox.bounds
        else:
            l = 0
            b = 0
            w = self.width
            h = self.height
        rows, cols = im.shape[:2]
        bitmap = wx.Bitmap.FromBufferRGBA(cols, rows, im.tostring())
        gc = self.get_gc()
        gc.select()
        gc.gfx_ctx.DrawBitmap(bitmap, int(l), int(self.height - b),
                              int(w), int(-h))
        gc.unselect() 
开发者ID:PacktPublishing,项目名称:Mastering-Elasticsearch-7.0,代码行数:18,代码来源:backend_wx.py

示例5: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Bitmap [as 别名]
def __init__(self, parent):
        wx.Panel.__init__(self, parent)
        
        imageFile = 'Tile.bmp'
        self.bmp = wx.Bitmap(imageFile)
        # react to a resize event and redraw image
        parent.Bind(wx.EVT_SIZE, self.canvasCallback)
                
        menu = wx.Menu()
        menu.Append(wx.ID_ABOUT, "About", "wxPython GUI")
        menu.AppendSeparator()
        menu.Append(wx.ID_EXIT, "Exit", " Exit the GUI")
        menuBar = wx.MenuBar()
        menuBar.Append(menu, "File") 
        parent.SetMenuBar(menuBar)  
         
        self.textWidget = wx.TextCtrl(self, size=(280, 80), style=wx.TE_MULTILINE)
                 
        button = wx.Button(self, label="Create OpenGL 3D Cube", pos=(60, 100))
        self.Bind(wx.EVT_BUTTON, self.buttonCallback, button)  
         
        parent.CreateStatusBar() 
开发者ID:PacktPublishing,项目名称:Python-GUI-Programming-Cookbook-Second-Edition,代码行数:24,代码来源:wxPython_Wallpaper.py

示例6: launchFileDialog

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Bitmap [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") 
开发者ID:OlafenwaMoses,项目名称:Model-Playgrounds,代码行数:27,代码来源:MainUI.py

示例7: launchFileDialog

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Bitmap [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") 
开发者ID:OlafenwaMoses,项目名称:Model-Playgrounds,代码行数:27,代码来源:MainUI.py

示例8: launchFileDialog

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Bitmap [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") 
开发者ID:OlafenwaMoses,项目名称:Model-Playgrounds,代码行数:27,代码来源:MainUI.py

示例9: launchFileDialog

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Bitmap [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") 
开发者ID:OlafenwaMoses,项目名称:Model-Playgrounds,代码行数:27,代码来源:MainUI.py

示例10: CreateMenuItem

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Bitmap [as 别名]
def CreateMenuItem(self, menu, label, func, icon=None, id=None):
        if id:
            item = wx.MenuItem(menu, id, label)
        else:
            item = wx.MenuItem(menu, -1, label)

        if icon:
            item.SetBitmap(wx.Bitmap(icon))

        if id:
            self.Bind(wx.EVT_MENU, func, id=id)
        else:
            self.Bind(wx.EVT_MENU, func, id=item.GetId())

        if wxgtk4 :
            menu.Append(item)
        else:
            menu.AppendItem(item)
        return item 
开发者ID:hschauhan,项目名称:gosync,代码行数:21,代码来源:GoSyncController.py

示例11: _load_bitmap

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Bitmap [as 别名]
def _load_bitmap(filename):
    """
    Load a bitmap file from the backends/images subdirectory in which the
    matplotlib library is installed. The filename parameter should not
    contain any path information as this is determined automatically.

    Returns a wx.Bitmap object
    """

    basedir = os.path.join(rcParams['datapath'], 'images')

    bmpFilename = os.path.normpath(os.path.join(basedir, filename))
    if not os.path.exists(bmpFilename):
        raise IOError('Could not find bitmap file "%s"; dying' % bmpFilename)

    bmp = wx.Bitmap(bmpFilename)
    return bmp 
开发者ID:holzschu,项目名称:python3_ios,代码行数:19,代码来源:backend_wx.py

示例12: resize_displays

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Bitmap [as 别名]
def resize_displays(self, use_ppi_px):
        if use_ppi_px:
            for (disp,
                 img_sz,
                 bez_szs,
                 st_bmp) in zip(self.display_rel_sizes,
                                self.img_rel_sizes,
                                self.bz_rel_sizes,
                                self.preview_img_list):
                size, offs = disp
                bmp = wx.Bitmap.FromRGBA(img_sz[0], img_sz[1], red=0, green=0, blue=0, alpha=255)
                bmp_w_bez = self.bezels_to_bitmap(bmp, size, bez_szs)
                st_bmp.SetSize(size)
                st_bmp.SetPosition(offs)
                st_bmp.SetBitmap(bmp_w_bez)
        else:
            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.SetSize(size)
        self.draw_monitor_numbers(use_ppi_px) 
开发者ID:hhannine,项目名称:superpaper,代码行数:26,代码来源:gui.py

示例13: resize_and_bitmap

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Bitmap [as 别名]
def resize_and_bitmap(self, fname, size, enhance_color=False):
        """Take filename of an image and resize and center crop it to size."""
        try:
            pil = resize_to_fill(Image.open(fname), size, quality="fast")
        except UnidentifiedImageError:
            msg = ("Opening image '%s' failed with PIL.UnidentifiedImageError."
                   "It could be corrupted or is of foreign type.") % fname
            sp_logging.G_LOGGER.info(msg)
            # show_message_dialog(msg)
            black_bmp = wx.Bitmap.FromRGBA(size[0], size[1], red=0, green=0, blue=0, alpha=255)
            if enhance_color:
                return (black_bmp, black_bmp)
            return black_bmp
        img = wx.Image(pil.size[0], pil.size[1])
        img.SetData(pil.convert("RGB").tobytes())
        if enhance_color:
            converter = ImageEnhance.Color(pil)
            pilenh_bw = converter.enhance(0.25)
            brightns = ImageEnhance.Brightness(pilenh_bw)
            pilenh = brightns.enhance(0.45)
            imgenh = wx.Image(pil.size[0], pil.size[1])
            imgenh.SetData(pilenh.convert("RGB").tobytes())
            return (img.ConvertToBitmap(), imgenh.ConvertToBitmap())
        return img.ConvertToBitmap() 
开发者ID:hhannine,项目名称:superpaper,代码行数:26,代码来源:gui.py

示例14: draw_canvas

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Bitmap [as 别名]
def draw_canvas(self, dc, draw=True):
        if self.st_bmp_canvas:
            pos = self.st_bmp_canvas.GetPosition()
            bmp = self.st_bmp_canvas.GetBitmap()
            bmp_sz = bmp.GetSize()
            if not draw:
                bmp = wx.Bitmap.FromRGBA(bmp_sz[0], bmp_sz[1], red=30, green=30, blue=30, alpha=255)
            op = wx.COPY
            if bmp.IsOk():
                memDC = wx.MemoryDC()
                # memDC.SelectObject(wx.NullBitmap)
                memDC.SelectObject(bmp)

                dc.Blit(pos[0], pos[1],
                        bmp_sz[0], bmp_sz[1],
                        memDC, 0, 0, op, True)

                return True
            else:
                return False 
开发者ID:hhannine,项目名称:superpaper,代码行数:22,代码来源:gui.py

示例15: updateConnectStatus

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Bitmap [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 
开发者ID:JayHeng,项目名称:NXP-MCUBootUtility,代码行数:22,代码来源:uicore.py


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