예제 #1
0
파일: main.py 프로젝트: kimballh/Tide
 def receipt_st(self, event):
     print("Made it to receipt state")
     self.move_to_7_button.Destroy()
     self.reset_panel()
     print("I'm in receipt_st")
     pic = wx.ImageFromBitmap(wx.Bitmap('7 receipt.png'))
     pic = pic.Scale(self.display_length, self.display_height,
                     wx.IMAGE_QUALITY_HIGH)
     wx.StaticBitmap(self.pnl, -1, wx.Bitmap(pic), (0, 0))
     self.move_to_8_button = wx.Button(self,
                                       label="MOVE",
                                       pos=(0, 0),
                                       size=(self.display_length,
                                             self.display_height))
     self.Bind(wx.EVT_BUTTON, self.thank_you_st, self.move_to_8_button)
예제 #2
0
 def grab(self, bbox=None):
     if not self.app:
         self.app = wx.App()
     screen = wx.ScreenDC()
     size = screen.GetSize()
     bmp = wx.EmptyBitmap(size[0], size[1])
     mem = wx.MemoryDC(bmp)
     mem.Blit(0, 0, size[0], size[1], screen, 0, 0)
     del mem
     myWxImage = wx.ImageFromBitmap(bmp)
     im = Image.new('RGB', (myWxImage.GetWidth(), myWxImage.GetHeight()))
     im.fromstring(myWxImage.GetData())
     if bbox:
         im = im.crop(bbox)
     return im
예제 #3
0
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))
예제 #4
0
 def GetBitmap(self):
     if not self.bitmap:
         if self._img_type == _wx.BITMAP_TYPE_ICO:
             self.GetIcon()
             w, h = self.icon.GetWidth(), self.icon.GetHeight()
             self.bitmap = _wx.Bitmap(w, h)
             self.bitmap.CopyFromIcon(self.icon)
             # Hack - when user scales windows display icon may need scaling
             if w != self.iconSize or h != self.iconSize: # rescale !
                 self.bitmap = _wx.Bitmap(
                     _wx.ImageFromBitmap(self.bitmap).Scale(
                       self.iconSize, self.iconSize, _wx.IMAGE_QUALITY_HIGH))
         else:
             self.bitmap = _wx.Bitmap(self._img_path.s, self._img_type)
     return self.bitmap
예제 #5
0
    def load_image(self, name):
        img = wx.Bitmap(name, wx.BITMAP_TYPE_ANY)
        size = img.GetSize()
        image = wx.ImageFromBitmap(img)
        image = image.Rescale(size[0] * 70 / size[1], 70,
                              wx.IMAGE_QUALITY_HIGH)
        img = wx.BitmapFromImage(image)

        self.pics.append(name)
        self.list.Add(img)
        end = self.list.GetImageCount() - 1
        self.image_list.InsertImageItem(end, end)
        self.image_listW.InsertImageItem(end, end)
        self.image_list.EnsureVisible(end)
        self.image_listW.EnsureVisible(end)
예제 #6
0
파일: screencap.py 프로젝트: xbee/mypubsub
 def getScreenByWx(self):
     import wx
     wx.App()  # Need to create an App instance before doing anything
     screen = wx.ScreenDC()
     size = screen.GetSize()
     bmp = wx.EmptyBitmap(size[0], size[1])
     mem = wx.MemoryDC(bmp)
     mem.Blit(0, 0, size[0], size[1], screen, 0, 0)
     del mem  # Release bitmap
     #bmp.SaveFile('screenshot.png', wx.BITMAP_TYPE_PNG)
     myWxImage = wx.ImageFromBitmap(myBitmap)
     PilImage = Image.new('RGB',
                          (myWxImage.GetWidth(), myWxImage.GetHeight()))
     PilImage.fromstring(myWxImage.GetData())
     return PilImage
예제 #7
0
    def _addImage(self, image):
        wxImage = None
        if type(image) in types.StringTypes:
            try:
                wxImage = wx.ImageFromBitmap(wx.Bitmap(image))
            except:
                pass
        else:
            wxImage = wx.ImageFromBitmap(image)
        if wxImage is None:
            return

        width, height = wxImage.GetSize()
        if width > 70:
            height = height * 70 / width
            width = 70
        if height > 52:
            width = width * 52 / height
            height = 52
        wxImage.Rescale(width, height, wx.IMAGE_QUALITY_NORMAL)
        wxImage.Resize((70, 52), ((70 - width) / 2, (52 - height) / 2))
        ctrl = wx.StaticBitmap(self._imageScroll, -1,
                               wx.BitmapFromImage(wxImage))
        if type(image) in types.StringTypes:
            ctrl.imageFilename = image
        else:
            ctrl.imageData = image

        delButton = wx.Button(ctrl, -1, 'X', style=wx.BU_EXACTFIT)
        self.Bind(wx.EVT_BUTTON, self.OnDeleteImage, delButton)

        self._imageScroll.GetSizer().Insert(
            len(self._imageScroll.GetChildren()) - 3, ctrl)
        self._imageScroll.Layout()
        self._imageScroll.Refresh()
        self._imageScroll.SetupScrolling(scroll_x=True, scroll_y=False)
예제 #8
0
	def onSave( self, event ):
		dlg = wx.FileDialog(
			self,
			message=_('Save Finish as'),
			wildcard=u"PNG {} (*.png)|*.png".format(_("files")),
			defaultDir=os.path.dirname( Utils.getFileName() or '.' ),
			defaultFile=os.path.splitext( os.path.basename(Utils.getFileName() or _('Default.cmn')) )[0] + u'_Finish.png',
			style=wx.SAVE,
		)
		if dlg.ShowModal() == wx.ID_OK:
			fname = dlg.GetPath()
			bm = self.finish.GetBitmap()
			image = wx.ImageFromBitmap( bm )
			image.SaveFile( fname, wx.BITMAP_TYPE_PNG )
		dlg.Destroy()
예제 #9
0
	def generate_image(self):
	#Red,Green,Blue,Marooon,Cyan,Yellow,Magenta,Purple,Navy,Gray(BGR format NOT RGB)
		#colors = {0:(0,0,255),1:(0,255,0),2:(255,0,0),3:(0,0,128),4:(255,255,0),5:(0,255,255),6:(255,0,255),7:(128,0,128)
		#		,8:(128,0,0),9:(128,128,128)}
		colors = [(0,0,255), (0,255,0), (255,0,0)]
		for i in range(self.k):
			colors.append((random.choice(range(256)), random.choice(range(256)),random.choice(range(256))))
		conn = getConnBaseDB()
		#Query DB to get boundary values for this image.
		c = conn.cursor()
		c.execute("SELECT BOUNDARY_VALS FROM Features WHERE IMAGE_NAME = '%s'" %self.filename)
		rows = c.fetchall()
		contour_list = []
		for row in rows:
			boundary_vals = row[0].strip().split(';')
			boundary_vals.pop()
			boundary_vals = [[int(float(n)) for n in i.split(',')] for i in boundary_vals]
			contr = np.array(boundary_vals)
			contour_list.append(contr)

		print self.fullFilename
		im = cv2.imread(self.fullFilename)
		for index,i in enumerate(self.clusterIds):
			cv2.drawContours(im,contour_list,index,colors[i],-1)

		outputfile = "Output_"+self.filename+"_clustered_"+str(int(time.time()))+".tif"
		cv2.imwrite(outputfile,im);


		print "'Done Displaying the image"
		imageFile = outputfile
                print imageFile
                win = wx.Frame(None, title = imageFile, size=(500,500),
                                                style = wx.DEFAULT_FRAME_STYLE ^wx.RESIZE_BORDER)
                ipanel = wx.Panel(win, -1)

		image = wx.ImageFromBitmap(wx.Bitmap(imageFile))
		image = image.Scale(500,500, wx.IMAGE_QUALITY_HIGH)
		
		bitmap = wx.BitmapFromImage(image)
		control = wx.StaticBitmap(ipanel,-1,bitmap)
		control.SetPosition((10,10))
		win.Show(True)

		#cv2.imshow('image',im)
		#print "show window"
		#cv2.waitKey()
		print "byee"
예제 #10
0
 def load_character(self, name='', character=None):
     if character is None:
         character = self.resources.cast.get_character(name=name)
     sprite_builder = character.get_sprite_builder(index=0)
     costume = sprite_builder.costumes.costumes[
         sprite_builder.costumes.costumes_list[0]]
     self.events.send('spriteloaded', costume=costume)
     width, height, raw_image = costume.get_raw_image()
     bitmap = wx.BitmapFromBufferRGBA(width, height, raw_image)
     image = wx.ImageFromBitmap(bitmap)
     image_scaled = image.Scale(30, 30, wx.IMAGE_QUALITY_HIGH)
     sprite_bitmap = wx.BitmapFromImage(image_scaled)
     self.il.Add(sprite_bitmap)
     index = self.GetItemCount()
     index = self.InsertImageStringItem(index, character.name, 0)
     self.resources.cast.set_index(character.name, index)
예제 #11
0
    def GetWxImage(self):

        (width, height) = self._size

        if self._format == wx.BitmapBufferFormat_RGB:
            return wx.ImageFromBuffer(width, height, lz4.loads(self._data))
        else:

            bitmap = wx.BitmapFromBufferRGBA(width, height,
                                             lz4.loads(self._data))

            image = wx.ImageFromBitmap(bitmap)

            wx.CallAfter(bitmap.Destroy)

            return image
def loadGLTexture(filename):
	tex = glGenTextures(1)
	glBindTexture(GL_TEXTURE_2D, tex)
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)
	img = wx.ImageFromBitmap(wx.Bitmap(getPathForImage(filename)))
	rgbData = img.GetData()
	alphaData = img.GetAlphaData()
	if alphaData is not None:
		data = ''
		for i in xrange(0, len(alphaData)):
			data += rgbData[i*3:i*3+3] + alphaData[i]
		glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, img.GetWidth(), img.GetHeight(), 0, GL_RGBA, GL_UNSIGNED_BYTE, data)
	else:
		glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, img.GetWidth(), img.GetHeight(), 0, GL_RGB, GL_UNSIGNED_BYTE, rgbData)
	return tex
예제 #13
0
    def SetBitmap(self, bm):
        if bm == self.bitmap:
            return

        if self.size != None and bm != None:
            image = wx.ImageFromBitmap(bm)
            image.Rescape(self.size[0], self.size[1])
            bm = image.ConvertToBitmap()
        self.bitmap = bm
        if self.bitmap:
            self.SetMinSize(self.bitmap.GetSize())
            self.SetSize(self.bitmap.GetSize())
        else:
            self.SetMinSize((0, 0))

        self.Refresh(True)
예제 #14
0
    def DrawIcon(self, dc, rect, pane):
        """
        Draws the icon in the pane caption area.

        :param `dc`: a :class:`DC` device context;
        :param Rect `rect`: the pane caption rectangle;
        :param `pane`: the pane for which the icon is drawn.
        """

        # Draw the icon centered vertically
        if pane.icon.Ok():
            if pane.HasCaptionLeft():
                bmp = wx.ImageFromBitmap(pane.icon).Rotate90(clockwise=False)
                dc.DrawBitmap(bmp.ConvertToBitmap(), rect.x+(rect.width-pane.icon.GetWidth())/2, rect.y+rect.height-2-pane.icon.GetHeight(), True)
            else:
                dc.DrawBitmap(pane.icon, rect.x+2, rect.y+(rect.height-pane.icon.GetHeight())/2, True)
예제 #15
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))
예제 #16
0
def resize_bitmap(parent, _bitmap, target_height):
    '''
  Resizes a bitmap to a height of 89 pixels (the
  size of the top panel), while keeping aspect ratio
  in tact
  '''
    image = wx.ImageFromBitmap(_bitmap)
    _width, _height = image.GetSize()
    if _height < target_height:
        # print 'returning image without resizing'
        return wx.StaticBitmap(parent, -1, wx.BitmapFromImage(image))
    # print 'returning resized image'
    ratio = float(_width) / _height
    image = image.Scale(target_height * ratio, target_height,
                        wx.IMAGE_QUALITY_HIGH)
    return wx.StaticBitmap(parent, -1, wx.BitmapFromImage(image))
예제 #17
0
	def set_shape(self):
		dc = wx.MemoryDC()
		bmp = wx.EmptyBitmap(*self.Size)
		dc.SelectObject(bmp)
		dc.Background = wx.WHITE_BRUSH
		dc.Clear()
		dc.Brush = wx.BLACK_BRUSH
		factor = 3
		dc.DrawRoundedRectangle(0, 0, self.Size[0]-factor, self.Size[1]-factor,
			radius)
		del dc

		img = wx.ImageFromBitmap(bmp)
		img.SetMaskColour(255,255,255)
		bmp = wx.BitmapFromImage(img)
		
		self.SetShape(wx.RegionFromBitmap(bmp))
예제 #18
0
파일: main.py 프로젝트: kimballh/Tide
 def place_bottle_instructions_st(self, event):
     self.move_to_3_button.Destroy()
     self.reset_panel()
     print("I'm in bottle_instructions_st")
     # self.bitmap1 = wx.StaticBitmap(self, -1, wx.Bitmap('3 place bottle.png'), (0,0))
     pic = wx.ImageFromBitmap(wx.Bitmap('3 place bottle.png'))
     pic = pic.Scale(self.display_length, self.display_height,
                     wx.IMAGE_QUALITY_HIGH)
     wx.StaticBitmap(self.pnl, -1, wx.Bitmap(pic), (0, 0))
     # self.pnl.Bind(wx.EVT_MOUSE_EVENTS, self.fill_instructions_st)
     self.move_to_4_button = wx.Button(self,
                                       label="MOVE",
                                       pos=(0, 0),
                                       size=(self.display_length,
                                             self.display_height))
     self.Bind(wx.EVT_BUTTON, self.fill_instructions_st,
               self.move_to_4_button)
예제 #19
0
파일: main.py 프로젝트: kimballh/Tide
 def end_fill_st(self, event=None):
     self.stop_button.Destroy()
     print("I made it here")
     self.reset_panel()
     print("I'm in end_fill_st")
     pic = wx.ImageFromBitmap(wx.Bitmap('6 count stopped.png'))
     pic = pic.Scale(self.display_length, self.display_height,
                     wx.IMAGE_QUALITY_HIGH)
     wx.StaticBitmap(self.pnl, -1, wx.Bitmap(pic), (0, 0))
     print("And I made it here")
     self.move_to_7_button = wx.Button(self,
                                       label="MOVE",
                                       pos=(0, 0),
                                       size=(self.display_length,
                                             self.display_height))
     self.Bind(wx.EVT_BUTTON, self.receipt_st, self.move_to_7_button)
     print("And done")
예제 #20
0
def scale_bitmap(bitmap, width, height, color):
    bw, bh = bitmap.GetWidth(), bitmap.GetHeight()
    if bw == width and bh == height:
        return bitmap
    if width < 0:
        width = bw
    if height < 0:
        height = bh
    buffer = wx.EmptyBitmap(bw, bh)
    dc = wx.MemoryDC(buffer)
    dc.SetBackground(wx.Brush(color))
    dc.Clear()
    dc.DrawBitmap(bitmap, 0, 0, True)
    image = wx.ImageFromBitmap(buffer)
    image = image.Scale(width, height, wx.IMAGE_QUALITY_HIGH)
    result = wx.BitmapFromImage(image)
    return result
예제 #21
0
def export_to_images(main_frame):
    path, image_type = get_image_path(main_frame)
    if path is not None:
        path_without_extension, extension = path.rsplit(".", 1)
        periods, current_period = main_frame.get_export_periods()
        count = 1
        for period in periods:
            path = "%s_%d.%s" % (path_without_extension, count, extension)
            if overwrite_existing_path(main_frame, path):
                main_frame.main_panel.timeline_panel.drawing_area.controller.view_properties.displayed_period = period
                main_frame.main_panel.redraw_timeline()
                bitmap = main_frame.main_panel.get_current_image()
                image = wx.ImageFromBitmap(bitmap)
                image.SaveFile(path, image_type)
            count += 1
        main_frame.main_panel.timeline_panel.drawing_area.controller.view_properties.displayed_period = current_period
        main_frame.main_panel.redraw_timeline()
예제 #22
0
    def set_scale(self, event):
        amt = event.GetWheelRotation()
        units = amt / (-(event.GetWheelDelta()))

        _bitmap_ = self.bitmap_UGLASS.GetBitmap()
        glass_img = wx.ImageFromBitmap(_bitmap_)
        width = glass_img.GetWidth()
        height = glass_img.GetHeight()
        glass_img.Destroy()

        # Check scale direction and scale accordingly
        if units > 0:
            width = int(width / 1.2)
            height = int(height / 1.2)
        else:
            width = int(width * 1.2)
            height = int(height * 1.2)

        if (self.img_size[0] < width or self.img_size[1] < height):
            event.Skip()
            return
        elif (width > 10 * self.img_size[0] or height > 10 * self.img_size[1]):
            event.Skip()
            return

        (window_width, window_height) = self.GetSizeTuple()
        if (window_width / 2) > width and (window_height / 2) > height:
            event.Skip()
            return

        # Scale the original image not the one being displayed
        img_new = self.img_orig.Copy()
        img_new.Rescale(width, height, wx.IMAGE_QUALITY_HIGH)

        self.img_scale = (width / float(self.img_size[0]))
        self.rBand.setScale(self.img_scale)

        # Get the scale bitmap and set it on looking glass
        img_bitmap = wx.BitmapFromImage(img_new)
        self.bitmap_UGLASS.SetBitmap(img_bitmap)
        img_new.Destroy()

        self.pnl.SetScrollbars(1, 1, width, height)
        self.pnl.Refresh()
        event.Skip()
        gc.collect()
예제 #23
0
    def GetWxImage(self):

        (width, height) = self._size

        if self._format == wx.BitmapBufferFormat_RGB:

            return wx.ImageFromBuffer(width, height, self._GetData())

        else:

            bitmap = wx.BitmapFromBufferRGBA(width, height, self._GetData())

            image = wx.ImageFromBitmap(bitmap)

            bitmap.Destroy()

            return image
예제 #24
0
    def GetIndex(self, filename):
        """ Returns the index of the specified image.

        The image will be loaded and added to the image list if it is not
        already there.

        """

        # Try the cache first.
        index = self._cache.get(filename)
        if index is None:
            # Were we passed an image resource?
            if isinstance(filename, ImageResource):
                # Create an image.
                image = filename.create_image(size=(self._width, self._height))

            # If the filename is a string then it is the filename of some kind
            # of image (e.g 'foo.gif', 'image/foo.png' etc).
            elif isinstance(filename, str):
                # Load the image from the file.
                image = wx.Image(filename, wx.BITMAP_TYPE_ANY)

            # Otherwise the filename is *actually* an icon (in our case,
            # probably related to a MIME type).
            else:
                # Create a bitmap from the icon.
                bmp = wx.Bitmap(self._width, self._height)
                bmp.CopyFromIcon(filename)

                # Turn it into an image so that we can scale it.
                image = wx.ImageFromBitmap(bmp)

            # We force all images in the cache to be the same size.
            self._scale(image)

            # We also force them to be bitmaps!
            bmp = image.ConvertToBitmap()

            # Add the bitmap to the actual list...
            index = self.Add(bmp)

            # ... and update the cache.
            self._cache[filename] = index

        return index
예제 #25
0
def makewindow(name, sx, sy, dx, dy, ex, ey, hastoolbar):
    global id
    w = MainWindow(None, wx.ID_ANY, name, sx, sy, dx, dy, ex, ey, hastoolbar)
    frames[id] = w
    reverse_frames[w] = id
    scrolls[id] = w.scroll
    bitmap = wx.EmptyBitmap(1280, 1024)
    #Initiate to a nice grey colour
    dc = wx.MemoryDC(bitmap=bitmap)
    dc.SetBrush(wx.Brush((211, 211, 211), wx.SOLID))
    dc.DrawRectangle(-1, -1, 1280, 1024)
    dc.SelectObject(wx.NullBitmap)
    del dc
    #build buffer
    buffers[id] = wx.ImageFromBitmap(bitmap)
    w.Show(True)
    send(["Internal", "MakeWindow", id])
    id = id + 1
예제 #26
0
    def scale_bitmap(self):
        image = wx.ImageFromBitmap(wx.Bitmap('court.jpg', wx.BITMAP_TYPE_ANY))
        h = image.GetHeight()
        w = image.GetWidth()
        width, height = self.Size
        scale_factor = 2.6
        width, height = int(width/scale_factor), int(height/scale_factor)
        print(width)
        if w > h:
            new_w = width
            new_h = width*(h/w)
        else:
            new_w = width*(w/h)
            new_h = height

        image = image.Scale(new_w, new_h, wx.IMAGE_QUALITY_HIGH)

        return image
예제 #27
0
파일: main.py 프로젝트: kimballh/Tide
    def insert_card_st(self, event):
        self.move_to_2_button.Destroy()
        self.reset_panel()
        print("I'm in insert card state")
        pic = wx.ImageFromBitmap(wx.Bitmap('2 insert card.png'))
        pic = pic.Scale(self.display_length, self.display_height,
                        wx.IMAGE_QUALITY_HIGH)
        wx.StaticBitmap(self.pnl, -1, wx.Bitmap(pic), (0, 0))

        # GPIO.add_event_detect(BUTTON, GPIO.RISING, callback=self.place_bottle_instructions_st)
        # self.pnl.Bind(wx.EVT_MOUSE_EVENTS, self.place_bottle_instructions_st)
        self.move_to_3_button = wx.Button(self,
                                          label="MOVE",
                                          pos=(0, 0),
                                          size=(self.display_length,
                                                self.display_height))
        self.Bind(wx.EVT_BUTTON, self.place_bottle_instructions_st,
                  self.move_to_3_button)
예제 #28
0
def _py_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.
    """
    wPx = agg.width
    hPx = agg.height
    image = wx.EmptyImage(wPx, hPx)
    image.SetData(agg.tostring_rgb())

    if bbox is None:
        # agg => rgb -> image
        return image
    else:
        # agg => rgb -> image => bitmap => clipped bitmap => image
        return wx.ImageFromBitmap(_clipped_image_as_bitmap(image, bbox))
예제 #29
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)
예제 #30
0
파일: main.py 프로젝트: kimballh/Tide
    def welcome_st(self, event=None):

        print("I'm in welcome state")
        # self.bitmap1 = wx.StaticBitmap(self, -1, wx.Bitmap('1 welcome.png'), (0,0))
        pic = wx.ImageFromBitmap(wx.Bitmap('1 welcome.png'))
        pic = pic.Scale(self.display_length, self.display_height,
                        wx.IMAGE_QUALITY_HIGH)
        wx.StaticBitmap(self.pnl, -1, wx.Bitmap(pic), (0, 0))

        self.move_to_2_button = wx.Button(self,
                                          label="MOVE",
                                          pos=(0, 0),
                                          size=(self.display_length,
                                                self.display_height))
        self.Bind(wx.EVT_BUTTON, self.insert_card_st, self.move_to_2_button)
        # pnl = wx.Panel(self)
        # self.pnl.Bind(wx.EVT_MOUSE_EVENTS, self.insert_card_st)
        self.pnl.SetFocus()