當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。