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


Python wx.EmptyImage方法代码示例

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


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

示例1: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import EmptyImage [as 别名]
def __init__(self, parent, index, rgb, **kwargs):
        if 'title' in kwargs:
            title = kwargs['title']
        else:
            title = 'SPy Image'
#        wxFrame.__init__(self, parent, index, "SPy Frame")
#        wxScrolledWindow.__init__(self, parent, index, style = wxSUNKEN_BORDER)

        img = wx.EmptyImage(rgb.shape[0], rgb.shape[1])
        img = wx.EmptyImage(rgb.shape[1], rgb.shape[0])
        img.SetData(rgb.tostring())
        self.bmp = img.ConvertToBitmap()
        self.kwargs = kwargs
        wx.Frame.__init__(self, parent, index, title,
                          wx.DefaultPosition)
        self.SetClientSizeWH(self.bmp.GetWidth(), self.bmp.GetHeight())
        wx.EVT_PAINT(self, self.on_paint)
        wx.EVT_LEFT_DCLICK(self, self.left_double_click) 
开发者ID:spectralpython,项目名称:spectral,代码行数:20,代码来源:rasterwindow.py

示例2: callback

# 需要导入模块: import wx [as 别名]
# 或者: from wx import EmptyImage [as 别名]
def callback(self):
        try:
            path = self.parent.takeWebcam(
                        os.path.basename(self.temppath),
                        os.path.dirname(self.temppath),
                        ''
                    )

            # try this so WX doesnt freak out if the file isnt a bitmap
            pilimage = Image.open(path)
            myWxImage = wx.EmptyImage( pilimage.size[0], pilimage.size[1] )
            myWxImage.SetData( pilimage.convert( 'RGB' ).tostring() )
            bitmap = myWxImage.ConvertToBitmap()

            self.previewbitmap.SetBitmap(bitmap)
            self.previewbitmap.CenterOnParent()

        except Exception, e:
            logging.debug(
                    "Exception while showing camera preview: %s" % repr(e)) 
开发者ID:collingreen,项目名称:chronolapse,代码行数:22,代码来源:chronolapse.py

示例3: graph_caps

# 需要导入模块: import wx [as 别名]
# 或者: from wx import EmptyImage [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 
开发者ID:Pragmatismo,项目名称:Pigrow,代码行数:21,代码来源:make_timelapse.py

示例4: saveImageGL

# 需要导入模块: import wx [as 别名]
# 或者: from wx import EmptyImage [as 别名]
def saveImageGL(mvcanvas, filename):
    view = glGetIntegerv(GL_VIEWPORT)
    img = wx.EmptyImage(view[2], view[3] )
    pixels = glReadPixels(0, 0, view[2], view[3], GL_RGB,
                     GL_UNSIGNED_BYTE)
    img.SetData( pixels )
    img = img.Mirror(False)
    img.SaveFile(filename, wx.BITMAP_TYPE_PNG) 
开发者ID:bmershon,项目名称:laplacian-meshes,代码行数:10,代码来源:MeshCanvas.py

示例5: _convert_agg_to_wx_image

# 需要导入模块: import wx [as 别名]
# 或者: from wx import EmptyImage [as 别名]
def _convert_agg_to_wx_image(agg, bbox):
    """
    Convert the region of the agg buffer bounded by bbox to a wx.Image.  If
    bbox is None, the entire buffer is converted.

    Note: agg must be a backend_agg.RendererAgg instance.
    """
    if bbox is None:
        # agg => rgb -> image
        image = wx.EmptyImage(int(agg.width), int(agg.height))
        image.SetData(agg.tostring_rgb())
        return image
    else:
        # agg => rgba buffer -> bitmap => clipped bitmap => image
        return wx.ImageFromBitmap(_WX28_clipped_agg_as_bitmap(agg, bbox)) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:17,代码来源:backend_wxagg.py

示例6: SetValue

# 需要导入模块: import wx [as 别名]
# 或者: from wx import EmptyImage [as 别名]
def SetValue(self, value):
        self.value = value
        width, height = self.GetSize()
        image = wx.EmptyImage(width - 10, height - 10)
        image.SetRGBRect((1, 1, width - 12, height - 12), *value)
        self.SetBitmapLabel(image.ConvertToBitmap()) 
开发者ID:EventGhost,项目名称:EventGhost,代码行数:8,代码来源:ColourSelectButton.py

示例7: piltoimage

# 需要导入模块: import wx [as 别名]
# 或者: from wx import EmptyImage [as 别名]
def piltoimage(pil, hasAlpha):
    """
    Convert PIL Image to wx.Image.
    """
    image = wx.EmptyImage(*pil.size)
    rgbPil = pil.convert('RGB')
    if hasAlpha:
        image.SetData(rgbPil.tobytes())
        image.SetAlphaData(pil.convert("RGBA").tobytes()[3::4])
    else:
        new_image = rgbPil
        data = new_image.tobytes()
        image.SetData(data)
    return image 
开发者ID:EventGhost,项目名称:EventGhost,代码行数:16,代码来源:__init__.py

示例8: bmp_lst_scaled

# 需要导入模块: import wx [as 别名]
# 或者: from wx import EmptyImage [as 别名]
def bmp_lst_scaled(self, scale=1.0):
        if self._ini_wx_bmp_lst is None:

            NewW = 350

            wx_image = wx.EmptyImage(NewW, NewW)
            wxBitmap = wx_image.ConvertToBitmap()

            dc = wx.MemoryDC(wxBitmap)
            text = "No Shoebox data"
            w, h = dc.GetSize()
            tw, th = dc.GetTextExtent(text)
            dc.Clear()
            dc.DrawText(text, (w - tw) / 2, (h - th) / 2)  # display text in center
            dc.SelectObject(wxBitmap)
            del dc
            wx_bmp_lst = [[wxBitmap]]

        else:
            wx_bmp_lst = []
            for data_3d in self._ini_wx_bmp_lst:
                single_block_lst = []
                for sigle_img_data in data_3d:
                    single_block_lst.append(self._wx_bmp_scaled(sigle_img_data, scale))

                wx_bmp_lst.append(single_block_lst)

        return wx_bmp_lst 
开发者ID:dials,项目名称:dials,代码行数:30,代码来源:bitmap_from_array.py

示例9: flex_image_get_tile

# 需要导入模块: import wx [as 别名]
# 或者: from wx import EmptyImage [as 别名]
def flex_image_get_tile(self, x, y):
        # The supports_rotated_tiles_antialiasing_recommended flag in
        # the C++ FlexImage class indicates whether the underlying image
        # instance supports tilted readouts.  Anti-aliasing only makes
        # sense if it does.
        if (
            self.raw_image is not None
            and self.zoom_level >= 2
            and self.flex_image.supports_rotated_tiles_antialiasing_recommended
            and self.user_requests_antialiasing
        ):
            # much more computationally intensive to prepare nice-looking pictures of tilted readout
            self.flex_image.setZoom(self.zoom_level + 1)
            fraction = 512.0 / self.flex_image.size1() / (2 ** (self.zoom_level + 1))
            self.flex_image.setWindowCart(y, x, fraction)
            self.flex_image.prep_string()
            w, h = self.flex_image.ex_size2(), self.flex_image.ex_size1()
            assert w == 512
            assert h == 512
            wx_image = wx.EmptyImage(w / 2, h / 2)
            import PIL.Image as Image

            Image_from_bytes = Image.frombytes(
                "RGB", (512, 512), self.flex_image.as_bytes()
            )
            J = Image_from_bytes.resize((256, 256), Image.ANTIALIAS)
            wx_image.SetData(J.tostring())
            return wx_image.ConvertToBitmap()
        elif self.raw_image is not None:
            self.flex_image.setZoom(self.zoom_level)
            fraction = 256.0 / self.flex_image.size1() / (2 ** self.zoom_level)
            self.flex_image.setWindowCart(y, x, fraction)
            self.flex_image.prep_string()
            w, h = self.flex_image.ex_size2(), self.flex_image.ex_size1()
            assert w == 256
            assert h == 256
            wx_image = wx.EmptyImage(w, h)
            wx_image.SetData(self.flex_image.as_bytes())
            return wx_image.ConvertToBitmap()
        else:
            wx_image = wx.EmptyImage(256, 256)
            return wx_image.ConvertToBitmap() 
开发者ID:dials,项目名称:dials,代码行数:44,代码来源:tile_generation.py

示例10: _wx_img_w_cpp

# 需要导入模块: import wx [as 别名]
# 或者: from wx import EmptyImage [as 别名]
def _wx_img_w_cpp(self, np_2d_tmp, show_nums, palette, np_2d_mask=None):

        xmax = np_2d_tmp.shape[1]
        ymax = np_2d_tmp.shape[0]

        if np_2d_mask is None:
            np_2d_mask = np.zeros((ymax, xmax), "double")

        transposed_data = np.zeros((ymax, xmax), "double")
        transposed_mask = np.zeros((ymax, xmax), "double")

        transposed_data[:, :] = np_2d_tmp
        transposed_mask[:, :] = np_2d_mask

        flex_data_in = flex.double(transposed_data)
        flex_mask_in = flex.double(transposed_mask)

        if palette == "black2white":
            palette_num = 1
        elif palette == "white2black":
            palette_num = 2
        elif palette == "hot ascend":
            palette_num = 3
        else:  # assuming "hot descend"
            palette_num = 4

        img_array_tmp = self.wx_bmp_arr.gen_bmp(
            flex_data_in, flex_mask_in, show_nums, palette_num
        )

        np_img_array = img_array_tmp.as_numpy_array()

        height = np.size(np_img_array[:, 0:1, 0:1])
        width = np.size(np_img_array[0:1, :, 0:1])
        img_array = np.empty((height, width, 3), "uint8")
        img_array[:, :, :] = np_img_array[:, :, :]

        self._wx_image = (
            wx.EmptyImage(width, height) if WX3 else wx.Image(width, height)
        )
        self._wx_image.SetData(img_array.tostring())

        data_to_become_bmp = (self._wx_image, width, height)

        return data_to_become_bmp 
开发者ID:dials,项目名称:dials,代码行数:47,代码来源:bitmap_from_array.py


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