Exemplo n.º 1
0
    def on_paint(self, event):
        resp, rgb = httplib2.Http().request("http://139.91.185.49:8082/rgb.raw")
        resp, depth = httplib2.Http().request("http://139.91.185.49:8082/depth.raw")
        # establish the painting surface
        dc = wx.PaintDC(self.panel)

        rgbBitmap = wx.BitmapFromBits (rgb, 640, 480, 24) 
        dc.DrawBitmap( rgbBitmap, 1 , 1) 
        depthBitmap = wx.BitmapFromBits (depth, 640, 480, 16) 
        dc.DrawBitmap( depthBitmap, 600 , 1 , 1) 
def BitmapFromBits(bits, w, h, colour):
    """
    A utility function that creates a masked bitmap from raw bits (XBM format).

    :param string `bits`: the raw bits of the bitmap;
    :param integer `w`: the bitmap width;
    :param integer `h`: the bitmap height;
    :param Colour `colour`: the colour which will replace all white pixels in the
     raw bitmap.
    """

    img = wx.BitmapFromBits(bits, w, h).ConvertToImage()
    img.Replace(0, 0, 0, 123, 123, 123)
    img.Replace(255, 255, 255, colour.Red(), colour.Green(), colour.Blue())
    img.SetMaskColour(123, 123, 123)
    return wx.BitmapFromImage(img)
Exemplo n.º 3
0
 def rendercharset(self, charset):
     self.charchooser.ClearAll()
     self.charchooser.InsertColumn(0, 'Ch', width=25)
     self.charchooser.InsertColumn(1, 'Hex', width=35)
     self.charchooser.InsertColumn(2, 'Dec', width=35)
     self.imagelist = wx.ImageList(16, 16, 1)
     self.charchooser.SetImageList(self.imagelist, wx.IMAGE_LIST_SMALL)
     for charnum in range(0, 256):
         wxbitmap = wx.BitmapFromBits(charset[charnum * 8:charnum * 8 + 8],
                                      8, 8, 1)
         wximage = wx.ImageFromBitmap(wxbitmap).Scale(16, 16).Mirror()
         wxbitmap = wx.BitmapFromImage(wximage, 1)
         self.imagelist.Add(wxbitmap)
         pos = self.charchooser.InsertImageItem(charnum, charnum)
         self.charchooser.SetStringItem(pos, 1, hex(charnum)[2:])
         self.charchooser.SetStringItem(pos, 2, str(charnum))
Exemplo n.º 4
0
    def updatechars(self):
        setnum = self.charset.GetSelection()
        if setnum == 2:
            global custchars
            #wxbitmap = wx.BitmapFromBits(chars[charnum*8 : charnum*8+8],8,8,1)
            #wximage = wx.ImageFromBitmap(wxbitmap).Scale(16,16).Mirror()
            #wxbitmap = wx.BitmapFromImage(wximage,1)
            #self.imagelist.Replace(charnum, wxbitmap)
            #self.charchooser.Refresh()

            self.imagelist = wx.ImageList(16, 16, 1)
            self.charchooser.SetImageList(self.imagelist, wx.IMAGE_LIST_SMALL)
            for charnum in range(0, 256):
                wxbitmap = wx.BitmapFromBits(
                    custchars[charnum * 8:charnum * 8 + 8], 8, 8, 1)
                wximage = wx.ImageFromBitmap(wxbitmap).Scale(16, 16).Mirror()
                wxbitmap = wx.BitmapFromImage(wximage, 1)
                self.imagelist.Add(wxbitmap)
Exemplo n.º 5
0
    def __init__(self, app, parent):
        wx.ScrolledWindow.__init__(self, parent)
        self.app = app

        self.size = app.size

        w = app.cols * self.size
        h = app.rows * self.size

        self.SetVirtualSize((w, h))
        self.SetVirtualSizeHints(50, 50)
        self.SetScrollRate(1, 1)

        self.Bind(wx.EVT_LEFT_DOWN, self.OnMouse)
        self.Bind(wx.EVT_RIGHT_DOWN, self.OnMouse)
        self.Bind(wx.EVT_MOTION, self.OnMouse)
        self.Bind(wx.EVT_PAINT, self.OnPaint2)

        self.row = 0
        self.col = 0

        self.gray12 = wx.BitmapFromBits(gray12_bits, 16, 16)
Exemplo n.º 6
0
 def __init__(self, **kwargs):
     wx.Panel.__init__(self, **kwargs)
     self.SetBackgroundStyle(wx.BG_STYLE_COLOUR)
     self.stipple = wx.BitmapFromBits(gray12_bits, 16, 16)
     self.null_bg = True
     self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnErase)