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


Python wx.NullBitmap方法代码示例

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


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

示例1: _init_toolbar

# 需要导入模块: import wx [as 别名]
# 或者: from wx import NullBitmap [as 别名]
def _init_toolbar(self):
        DEBUG_MSG("_init_toolbar", 1, self)

        self._parent = self.canvas.GetParent()

        self.wx_ids = {}
        for text, tooltip_text, image_file, callback in self.toolitems:
            if text is None:
                self.AddSeparator()
                continue
            self.wx_ids[text] = (
                self.AddTool(
                    -1,
                    bitmap=_load_bitmap(image_file + ".png"),
                    bmpDisabled=wx.NullBitmap,
                    label=text, shortHelp=text, longHelp=tooltip_text,
                    kind=(wx.ITEM_CHECK if text in ["Pan", "Zoom"]
                          else wx.ITEM_NORMAL))
                .Id)
            self.Bind(wx.EVT_TOOL, getattr(self, callback),
                      id=self.wx_ids[text])

        self.Realize() 
开发者ID:PacktPublishing,项目名称:Mastering-Elasticsearch-7.0,代码行数:25,代码来源:backend_wx.py

示例2: draw_canvas

# 需要导入模块: import wx [as 别名]
# 或者: from wx import NullBitmap [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

示例3: add_image

# 需要导入模块: import wx [as 别名]
# 或者: from wx import NullBitmap [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

示例4: get_xpm_bitmap

# 需要导入模块: import wx [as 别名]
# 或者: from wx import NullBitmap [as 别名]
def get_xpm_bitmap(path):
    bmp = wx.NullBitmap
    if not os.path.exists(path):
        if '.zip' in path:
            import zipfile
            archive, name = path.split('.zip', 1)
            archive += '.zip'
            if name.startswith(os.sep):
                name = name.split(os.sep, 1)[1]
            if zipfile.is_zipfile(archive):
                # extract the XPM lines...
                try:
                    data = zipfile.ZipFile(archive).read(name)
                    data = [d[1:-1] for d in _get_xpm_bitmap_re.findall(data)]
                    bmp = wx.BitmapFromXPMData(data)
                except:
                    logging.exception(_('Internal Error'))
                    bmp = wx.NullBitmap
    else:
        bmp = wx.Bitmap(path, wx.BITMAP_TYPE_XPM)
    return bmp 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:23,代码来源:misc.py

示例5: _set_preview_bitmap

# 需要导入模块: import wx [as 别名]
# 或者: from wx import NullBitmap [as 别名]
def _set_preview_bitmap(self, prop, name, ref_size=None):
        if not config.use_gui:
            return
        bmp = prop.get_value()
        OK = True
        if bmp:
            bmp_d = self.get_preview_obj_bitmap(bmp)
            if ref_size and bmp_d.Size != ref_size:
                prop.set_check_result(error="Size %s is different from normal bitmap %s."%(bmp_d.Size, ref_size))
                OK = False
            else:
                prop.set_check_result(error=None)
        else:
            bmp_d = wx.NullBitmap
        prop.set_bitmap(bmp_d)
        if self.widget:
            if compat.IS_CLASSIC and name=="Pressed":
                method = getattr(self.widget, "SetBitmapSelected")  # probably only wx 2.8
            else:
                method = getattr(self.widget, "SetBitmap%s"%name, None)
            if method is not None:
                method(bmp_d if OK else wx.NullBitmap) 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:24,代码来源:gui_mixins.py

示例6: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import NullBitmap [as 别名]
def __init__(
        self,
        parent,
        value=(255, 255, 255),
        pos=wx.DefaultPosition,
        size=(40, wx.Button.GetDefaultSize()[1]),
        style=wx.BU_AUTODRAW,
        validator=wx.DefaultValidator,
        name="ColourSelectButton",
        title = "Colour Picker"
    ):
        self.value = value
        self.title = title
        wx.BitmapButton.__init__(
            self, parent, -1, wx.NullBitmap, pos, size, style, validator, name
        )
        self.SetValue(value)
        self.Bind(wx.EVT_BUTTON, self.OnButton) 
开发者ID:EventGhost,项目名称:EventGhost,代码行数:20,代码来源:ColourSelectButton.py

示例7: saveImage

# 需要导入模块: import wx [as 别名]
# 或者: from wx import NullBitmap [as 别名]
def saveImage(canvas, filename):
    s = wx.ScreenDC()
    w, h = canvas.size.Get()
    b = wx.EmptyBitmap(w, h)
    m = wx.MemoryDCFromDC(s)
    m.SelectObject(b)
    m.Blit(0, 0, w, h, s, 70, 0)
    m.SelectObject(wx.NullBitmap)
    b.SaveFile(filename, wx.BITMAP_TYPE_PNG) 
开发者ID:bmershon,项目名称:laplacian-meshes,代码行数:11,代码来源:MeshCanvas.py

示例8: _ToolBar_AddSimpleTool

# 需要导入模块: import wx [as 别名]
# 或者: from wx import NullBitmap [as 别名]
def _ToolBar_AddSimpleTool(self, toolId, bitmap, shortHelpString="", longHelpString="", isToggle=0):
    """
    Old style method to add a tool to the toolbar.
    """
    kind = wx.ITEM_NORMAL
    if isToggle: kind = wx.ITEM_CHECK
    return self.AddTool(toolId, '', bitmap, wx.NullBitmap, kind,
                        shortHelpString, longHelpString) 
开发者ID:dougthor42,项目名称:wafer_map,代码行数:10,代码来源:core.py

示例9: _ToolBar_AddLabelTool

# 需要导入模块: import wx [as 别名]
# 或者: from wx import NullBitmap [as 别名]
def _ToolBar_AddLabelTool(self, id, label, bitmap, bmpDisabled=wx.NullBitmap, kind=wx.ITEM_NORMAL, shortHelp="", longHelp="", clientData=None):
    """
    Old style method to add a tool in the toolbar.
    """
    return self.AddTool(id, label, bitmap, bmpDisabled, kind,
                        shortHelp, longHelp, clientData) 
开发者ID:dougthor42,项目名称:wafer_map,代码行数:8,代码来源:core.py

示例10: _ToolBar_InsertSimpleTool

# 需要导入模块: import wx [as 别名]
# 或者: from wx import NullBitmap [as 别名]
def _ToolBar_InsertSimpleTool(self, pos, toolId, bitmap, shortHelpString="", longHelpString="", isToggle=0):
    """
    Old style method to insert a tool in the toolbar.
    """
    kind = wx.ITEM_NORMAL
    if isToggle: kind = wx.ITEM_CHECK
    return self.InsertTool(pos, toolId, '', bitmap, wx.NullBitmap, kind,
                           shortHelpString, longHelpString) 
开发者ID:dougthor42,项目名称:wafer_map,代码行数:10,代码来源:core.py

示例11: _ToolBar_InsertLabelTool

# 需要导入模块: import wx [as 别名]
# 或者: from wx import NullBitmap [as 别名]
def _ToolBar_InsertLabelTool(self, pos, id, label, bitmap, bmpDisabled=wx.NullBitmap, kind=wx.ITEM_NORMAL, shortHelp="", longHelp="", clientData=None):
    """
    Old style method to insert a tool in the toolbar.
    """
    return self.InsertTool(pos, id, label, bitmap, bmpDisabled, kind,
                           shortHelp, longHelp, clientData) 
开发者ID:dougthor42,项目名称:wafer_map,代码行数:8,代码来源:core.py

示例12: blit

# 需要导入模块: import wx [as 别名]
# 或者: from wx import NullBitmap [as 别名]
def blit(self, bbox=None):
        """
        Transfer the region of the agg buffer defined by bbox to the display.
        If bbox is None, the entire buffer is transferred.
        """
        if bbox is None:
            self.bitmap = _convert_agg_to_wx_bitmap(self.get_renderer(), None)
            self.gui_repaint()
            return

        l, b, w, h = bbox.bounds
        r = l + w
        t = b + h
        x = int(l)
        y = int(self.bitmap.GetHeight() - t)

        srcBmp = _convert_agg_to_wx_bitmap(self.get_renderer(), None)
        srcDC = wx.MemoryDC()
        srcDC.SelectObject(srcBmp)

        destDC = wx.MemoryDC()
        destDC.SelectObject(self.bitmap)

        destDC.BeginDrawing()
        destDC.Blit(x, y, int(w), int(h), srcDC, x, y)
        destDC.EndDrawing()

        destDC.SelectObject(wx.NullBitmap)
        srcDC.SelectObject(wx.NullBitmap)
        self.gui_repaint() 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:32,代码来源:backend_wxagg.py

示例13: _WX28_clipped_agg_as_bitmap

# 需要导入模块: import wx [as 别名]
# 或者: from wx import NullBitmap [as 别名]
def _WX28_clipped_agg_as_bitmap(agg, bbox):
    """
    Convert the region of a the agg buffer bounded by bbox to a wx.Bitmap.

    Note: agg must be a backend_agg.RendererAgg instance.
    """
    l, b, width, height = bbox.bounds
    r = l + width
    t = b + height

    srcBmp = wx.BitmapFromBufferRGBA(int(agg.width), int(agg.height),
        agg.buffer_rgba())
    srcDC = wx.MemoryDC()
    srcDC.SelectObject(srcBmp)

    destBmp = wx.EmptyBitmap(int(width), int(height))
    destDC = wx.MemoryDC()
    destDC.SelectObject(destBmp)

    destDC.BeginDrawing()
    x = int(l)
    y = int(int(agg.height) - t)
    destDC.Blit(0, 0, int(width), int(height), srcDC, x, y)
    destDC.EndDrawing()

    srcDC.SelectObject(wx.NullBitmap)
    destDC.SelectObject(wx.NullBitmap)

    return destBmp 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:31,代码来源:backend_wxagg.py

示例14: unselect

# 需要导入模块: import wx [as 别名]
# 或者: from wx import NullBitmap [as 别名]
def unselect(self):
        """
        Select a Null bitmasp into this wxDC instance
        """
        if sys.platform=='win32':
            self.dc.SelectObject(wx.NullBitmap)
            self.IsSelected = False 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:9,代码来源:backend_wx.py

示例15: blit

# 需要导入模块: import wx [as 别名]
# 或者: from wx import NullBitmap [as 别名]
def blit(self, bbox=None):
        """
        Transfer the region of the agg buffer defined by bbox to the display.
        If bbox is None, the entire buffer is transferred.
        """
        if bbox is None:
            self.bitmap = _convert_agg_to_wx_bitmap(self.get_renderer(), None)
            self.gui_repaint()
            return

        l, b, w, h = bbox.bounds
        r = l + w
        t = b + h
        x = int(l)
        y = int(self.bitmap.GetHeight() - t)

        srcBmp = _convert_agg_to_wx_bitmap(self.get_renderer(), None)
        srcDC = wx.MemoryDC()
        srcDC.SelectObject(srcBmp)

        destDC = wx.MemoryDC()
        destDC.SelectObject(self.bitmap)

        destDC.Blit(x, y, int(w), int(h), srcDC, x, y)

        destDC.SelectObject(wx.NullBitmap)
        srcDC.SelectObject(wx.NullBitmap)
        self.gui_repaint() 
开发者ID:PacktPublishing,项目名称:Mastering-Elasticsearch-7.0,代码行数:30,代码来源:backend_wxagg.py


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