示例#1
0
 def createBrushes(self):
     self.brushes = {}
     brush = Brush()
     brush.SetStyle(BRUSHSTYLE_SOLID)
     brush.SetColour(Colour(52, 61, 70))
     self.brushes['bkgd'] = brush
     return
示例#2
0
def createSolidBrush(brushName, colourName):
    # make brush
    brush = Brush()
    brush.SetStyle(BRUSHSTYLE_SOLID)
    brush.SetColour(_colours[colourName])
    # add brush
    _brushes[brushName] = brush
    # done
    return
示例#3
0
    def OnDrawBackground(self,dc,rect,n):
        if self.Selection == n:
            dc.Brush = Brush(wx.SystemSettings_GetColour(wx.SYS_COLOUR_HIGHLIGHT))

            #wx.VListBox.OnDrawBackground(self,dc,rect,n)
            #return
        else:
            dc.Brush = Brush(hovbgcolor if self.Hovered == n else bgcolors[n % len(bgcolors)])
        dc.Pen = wx.TRANSPARENT_PEN
        dc.DrawRectangleRect(rect)
示例#4
0
 def createBrushes(self):
     # BRUSHES
     self.brushes = {}
     # background brush
     brush = Brush()
     brush.SetStyle(BRUSHSTYLE_SOLID)
     brush.SetColour(Colour(52, 61, 70))
     self.brushes['bkgd'] = brush
     # done
     return
示例#5
0
 def createCharBitmaps(self):
     dc = MemoryDC()
     dc.SetFont(self.fonts['monospace'])
     cw, ch = dc.GetTextExtent(' ')
     self.charSize = cw, ch
     self.normalChars = {}
     for c in self.charSet:
         bitmap = Bitmap(cw, ch, BITMAP_SCREEN_DEPTH)
         dc.SelectObject(bitmap)
         dc.SetBackground(self.brushes['bkgd'])
         dc.Clear()
         dc.SetTextForeground(Colour(230, 230, 230))
         dc.DrawText(c, 0, 0)
         self.normalChars[c] = bitmap
     self.selectedChars = {}
     for c in self.charSet:
         bitmap = Bitmap(cw, ch, BITMAP_SCREEN_DEPTH)
         dc.SelectObject(bitmap)
         dc.SetBackground(Brush(Colour(70, 80, 90)))
         dc.Clear()
         dc.SetTextForeground(Colour(160, 160, 180))
         if c == ' ': dc.DrawText(c, 0, 0)
         else: dc.DrawText(c, 0, 0)
         self.selectedChars[c] = bitmap
     self.numberChars = {}
     for c in ' 0123456789':
         bitmap = Bitmap(cw, ch, BITMAP_SCREEN_DEPTH)
         dc.SelectObject(bitmap)
         dc.SetBackground(self.brushes['bkgd'])
         dc.Clear()
         dc.SetTextForeground(Colour(150, 150, 200))
         dc.DrawText(c, 0, 0)
         self.numberChars[c] = bitmap
     dc.SelectObject(NullBitmap)
     return
示例#6
0
    def DrawNativeBackgroundFallback(self, dc, part, state, unusedrect):

        rect = wx.RectS(self.Size)

        dc.Brush = Brush(wx.SystemSettings_GetColour(wx.SYS_COLOUR_WINDOW))
        dc.Pen = wx.TRANSPARENT_PEN  #wx.Pen(wx.SystemSettings_GetColour(wx.SYS_COLOUR_WINDOWFRAME))
        dc.DrawRectangleRect(rect)
示例#7
0
    def CreateDC(self, loadBackground: bool, w: int, h: int) -> DC:
        """
        Create a DC, load the background on demand.

        @param loadBackground
        @param w : width of the frame.
        @param h :  height of the frame.

        @return DC
        """
        dc = MemoryDC()
        bm = self.__workingBitmap
        # cache the bitmap, to avoid creating a new at each refresh.
        # only recreate it if the size of the window has changed
        if (bm.GetWidth(), bm.GetHeight()) != (w, h):
            bm = self.__workingBitmap = Bitmap(w, h)
        dc.SelectObject(bm)
        if loadBackground:
            self.LoadBackground(dc, w, h)
        else:
            dc.SetBackground(Brush(self.GetBackgroundColour()))
            dc.Clear()
        self.PrepareDC(dc)

        return dc
示例#8
0
文件: OglNote.py 项目: hasii2011/PyUt
    def __init__(self, pyutNote=None, w: int = 0, h: int = 0):
        """

        Args:
            pyutNote:   A PyutNote Object
            w:          Default width override
            h:          Default height override
        """

        # Init pyutObject (coming from OglObject)
        if pyutNote is None:
            pyutObject = PyutNote()
        else:
            pyutObject = pyutNote

        width: int = w
        height: int = h
        prefs: PyutPreferences = PyutPreferences()
        if width == 0:
            width = prefs.noteDimensions.width
        if height == 0:
            height = prefs.noteDimensions.height

        super().__init__(pyutObject, width, height)

        self.logger: Logger = getLogger(__name__)
        self.SetBrush(Brush(Colour(255, 255, 230)))
示例#9
0
    def OnDrawBackground(self, dc, rect, n):
        s = self.IsSelected(n)
        h = self.Hovered

        dc.Brush = Brush(GetSysColor(wx.SYS_COLOUR_HIGHLIGHT) if s else wx.Color(220, 220, 220) if h==n else bgcolors[n%len(bgcolors)])
        dc.Pen   = wx.TRANSPARENT_PEN
        dc.DrawRectangle(*rect)
    def Draw(self, grid, attr, dc, rect, row, col, isSelected):
        """ Draw the appropriate icon into the specified grid cell. """

        # clear the cell first
        if isSelected:
            bgcolor = grid.GetSelectionBackground()
        else:
            bgcolor = grid.GetCellBackgroundColour(row, col)

        dc.SetBackgroundMode(SOLID)
        dc.SetBrush(Brush(bgcolor, SOLID))
        dc.SetPen(TRANSPARENT_PEN)
        dc.DrawRectangle(rect.x, rect.y, rect.width, rect.height)

        # find the correct image for this cell
        bmp = self._get_image(grid, row, col)
        # find the correct text for this cell
        text = self._get_text(grid, row, col)

        # figure out placement -- we try to center things!
        # fixme: we should be responding to the horizontal/vertical
        #        alignment info in the attr object!
        size = self.GetBestSize(grid, attr, dc, row, col)

        halign, valign = attr.GetAlignment()

        # width first
        wdelta = rect.width - size.GetWidth()
        x = rect.x
        if halign == wx.ALIGN_CENTRE and wdelta > 0:
            x += wdelta / 2

        # now height
        hdelta = rect.height - size.GetHeight()

        y = rect.y
        if valign == wx.ALIGN_CENTRE and hdelta > 0:
            y += hdelta / 2

        dc.SetClippingRegion(*rect)

        if bmp is not None:
            # now draw our image into it
            dc.DrawBitmap(bmp, x, y, 1)
            x += bmp.GetWidth()

        if text is not None and text != '':
            width = rect.x + rect.width - x
            height = rect.y + rect.height - y
            # draw any text that should be included
            new_rect = Rect(x, y, width, height)
            self._string_renderer.Draw(grid, attr, dc, new_rect, row, col,
                                       isSelected)

        dc.DestroyClippingRegion()

        return
示例#11
0
 def refreshBuffer(self):
     X, Y = self.scroll
     cw, ch = self.charSize
     sl, sr, st, sb = 5, 15, 5, 5
     cl, rw = self.screenSize
     dc = MemoryDC()
     dc.SelectObject(self.bmpBuf)
     dc.SetBackground(self.brushes['bkgd'])
     dc.Clear()
     x3, x4 = 0 * cw, cl * cw
     x1, y1 = (sl - 0.5) * cw, (st - 0.5) * ch
     x2, y2 = (cl - sr + 0.5) * cw, (rw - sb + 0.5) * ch
     dc.SetPen(self.pens['margin'])
     dc.DrawLine(x1, y1, x1, y2)
     dc.DrawLine(x2, y1, x2, y2)
     dc.DrawLine(x3, y1, x4, y1)
     dc.DrawLine(x3, y2, x4, y2)
     c1, r1, c2, r2 = self.getBlockGeometry()
     dc.SetBrush(Brush(Colour(100, 100, 100)))
     dc.SetPen(self.pens['transparent'])
     x, y = 0, -1
     for line in self.chrBuf[Y:]:
         y += 1
         if y + st >= rw - sb: break
         self.drawText(dc, f'{y+Y:4d}', 0, y + st, self.numberChars)
         if y + Y < r1 or y + Y > r2:
             self.drawText(dc, line[X:], x + sl, y + st, self.normalChars)
             continue
         if r1 == r2:
             self.drawText(dc, line[X:], x + sl, y + st, self.normalChars)
             self.drawText(dc, line[X:c2], x + sl, y + st,
                           self.selectedChars)
             self.drawText(dc, line[X:c1], x + sl, y + st, self.normalChars)
             continue
         if y + Y == r1:
             self.drawText(dc, line[X:] + '¶', x + sl, y + st,
                           self.selectedChars)
             self.drawText(dc, line[X:c1], x + sl, y + st, self.normalChars)
             continue
         if y + Y == r2:
             self.drawText(dc, line[X:], x + sl, y + st, self.normalChars)
             self.drawText(dc, line[X:c2], x + sl, y + st,
                           self.selectedChars)
             continue
         self.drawText(dc, line[X:] + '¶', x + sl, y + st,
                       self.selectedChars)
     x, y = self.cursor
     x1, y1, y2 = (x + sl) * cw, (y + st) * ch, (y + st + 1) * ch - 1
     dc.SetPen(self.pens['cursor'])
     dc.DrawLine(x1, y1, x1, y2)
     dc.SelectObject(NullBitmap)
     return
示例#12
0
 def ClearBackground(self):
     """
     Clear the background image.
     """
     dc = MemoryDC()
     bb = self.__backgroundBitmap
     w, h = self.GetSize()
     if (bb.GetWidth(), bb.GetHeight()) != (w, h):
         bb = self.__backgroundBitmap = EmptyBitmap(w, h)
     dc.SelectObject(bb)
     dc.SetBackground(Brush(self.GetBackgroundColour()))
     dc.Clear()
     dc.SelectObject(NullBitmap)
示例#13
0
    def __init__(self, pyutNote=None, w=100, h=50):
        """
        Constructor.

        @param pyutNote : a PyutNote object
        @param  w : Width of the shape
        @param  h : Height of the shape
        @since 1.0
        @author Philippe Waelti<*****@*****.**>
        """
        # Init pyutObject (coming from OglObject)
        if pyutNote is None:
            pyutObject = PyutNote()
        else:
            pyutObject = pyutNote
        super().__init__(pyutObject, w, h)

        self.logger: Logger = getLogger(__name__)
        self.SetBrush(Brush(Colour(255, 255, 230)))
示例#14
0
    def OnPaint(self, event: PaintEvent):
        """
        Callback.
        Refresh the screen when a paint event is issued by the system.

        @param event
        """
        dc = PaintDC(self)
        w, h = self.GetSize()
        mem = self.CreateDC(False, w, h)
        mem.SetBackground(Brush(self.GetBackgroundColour()))
        mem.Clear()
        self.Redraw(mem)

        if __version__ > "2.3.2":
            x, y = self.CalcUnscrolledPosition(0, 0)
            dc.Blit(0, 0, w, h, mem, x, y)
        else:
            dc.Blit(0, 0, w, h, mem, 0, 0)
示例#15
0
    def OnPaint(self, event: PaintEvent):
        """
        Refresh the screen when a paint event is issued by the system.

        Args:
            event:
        """
        dc = PaintDC(self)
        w, h = self.GetSize()
        mem = self.CreateDC(False, w, h)
        mem.SetBackground(Brush(self.GetBackgroundColour()))
        mem.Clear()

        x, y = self.CalcUnscrolledPosition(0, 0)
        #
        # self.clsLogger.warning(f'OnPaint - {w=}, {h=} {x=} {y=}')
        # Paint events don't seem to be generated when Pyut is built for deployment;  So code duplicated in .Redraw()
        #
        if self._prefs.backgroundGridEnabled is True:
            self._drawGrid(memDC=mem, width=w, height=h, startX=x, startY=y)
        self.Redraw(mem)

        dc.Blit(0, 0, w, h, mem, x, y)
示例#16
0
    def refreshBuffer(self):
        # get geometry
        X, Y = self.scroll
        cw, ch = self.charSize
        sl, sr, st, sb = 5, 15, 5, 5
        cl, rw = self.screenSize
        # create device context
        dc = MemoryDC()               
        # select
        dc.SelectObject(self.bmpBuf)
        # set background
        dc.SetBackground(self.brushes['bkgd'])
        # and clear buffer
        dc.Clear()
        # draw margins
        x3, x4 = 0*cw, cl*cw
        x1, y1 = (sl-0.5)*cw, (st-0.5)*ch
        x2, y2 = (cl-sr+0.5)*cw, (rw-sb+0.5)*ch
        dc.SetPen(self.pens['margin'])
        dc.DrawLine(x1, y1, x1, y2)
        dc.DrawLine(x2, y1, x2, y2)
        dc.DrawLine(x3, y1, x4, y1)
        dc.DrawLine(x3, y2, x4, y2)
        # get block geometry
        c1, r1, c2, r2 = self.getBlockGeometry()
        # set brush
        dc.SetBrush(Brush(Colour(100,100,100)))
        dc.SetPen(self.pens['transparent'])
        # draw text
        x, y = 0, -1
        for line in self.chrBuf[Y:]:
            y += 1
            if y+st >= rw-sb: break
            # draw line number
            self.drawText(dc, f'{y+Y:4d}', 0, y+st, self.numberChars)
            # the line is outside of the block
            if y+Y < r1 or y+Y > r2:
                self.drawText(dc, line[X:], x+sl, y+st, self.normalChars)
                continue
            # block is inside if the line
            if r1 == r2:
                self.drawText(dc, line[X:],   x+sl, y+st, self.normalChars)
                self.drawText(dc, line[X:c2], x+sl, y+st, self.selectedChars)
                self.drawText(dc, line[X:c1], x+sl, y+st, self.normalChars)
                continue
            # line at the start of the block
            if y+Y == r1:
                self.drawText(dc, line[X:]+'¶',   x+sl, y+st, self.selectedChars)
                self.drawText(dc, line[X:c1], x+sl, y+st, self.normalChars)
                continue
            # line at the end of the block
            if y+Y == r2:
                self.drawText(dc, line[X:],   x+sl, y+st, self.normalChars)
                self.drawText(dc, line[X:c2], x+sl, y+st, self.selectedChars)
                continue
            # line is inside the block
            self.drawText(dc, line[X:]+'¶', x+sl, y+st, self.selectedChars)

        # draw cursor
        x, y = self.cursor
        x1, y1, y2 = (x+sl)*cw, (y+st)*ch, (y+st+1)*ch-1
        dc.SetPen(self.pens['cursor'])
        dc.DrawLine(x1, y1, x1, y2)
        # done
        dc.SelectObject(NullBitmap)
        return
示例#17
0
 def createCharBitmaps(self):
     # create device context
     dc = MemoryDC()               
     # set font
     dc.SetFont(self.fonts['monospace'])
     # get font size (monospace)
     cw, ch = dc.GetTextExtent(' ')
     # record geometry
     self.charSize = cw, ch
     # NORMAL CHARACTERS
     self.normalChars = {}
     # create bitmaps
     for c in self.charSet:
         # create black and white bitmap
         bitmap = Bitmap(cw, ch, BITMAP_SCREEN_DEPTH)
         # select bitmap
         dc.SelectObject(bitmap)
         # set background
         dc.SetBackground(self.brushes['bkgd'])
         # clear bitmap
         dc.Clear()
         # set text color
         dc.SetTextForeground(Colour(230,230,230))
         # write character
         dc.DrawText(c,0,0)
         # create reference to bitmap
         self.normalChars[c] = bitmap
     # SELECTED CHARACTERS
     self.selectedChars = {}
     # create bitmaps
     for c in self.charSet:
         # create black and white bitmap
         bitmap = Bitmap(cw, ch, BITMAP_SCREEN_DEPTH)
         # select bitmap
         dc.SelectObject(bitmap)
         # set background
         dc.SetBackground(Brush(Colour(70, 80, 90)))
         # clear bitmap
         dc.Clear()
         # set text color
         dc.SetTextForeground(Colour(160,160,180))
         # write character
         dc.DrawText(c,0,0)
         # create reference to bitmap
         self.selectedChars[c] = bitmap
     # NUMBER CHARACTERS
     self.numberChars = {}
     # create bitmaps
     for c in ' 0123456789':
         # create black and white bitmap
         bitmap = Bitmap(cw, ch, BITMAP_SCREEN_DEPTH)
         # select bitmap
         dc.SelectObject(bitmap)
         # set background
         dc.SetBackground(self.brushes['bkgd'])
         # clear bitmap
         dc.Clear()
         # set text color
         dc.SetTextForeground(Colour(150,150,200))
         # write character
         dc.DrawText(c,0,0)
         # create reference to bitmap
         self.numberChars[c] = bitmap
     # release bitmap
     dc.SelectObject(NullBitmap)
     # done
     return
示例#18
0
    def paint(self, e):
        #
        # translation from C++ version in VListBox::OnPaint
        #


        clientSize = self.ClientSize
        dc = BufferedPaintDC(self)

        # the update rectangle
        rectUpdate = self.GetUpdateClientRect()

        # fill background
        crect = self.ClientRect

        if self.bg is not None:
            self.bg.Draw(dc, crect)
        else:
            dc.Brush = Brush(self.BackgroundColour)
            dc.Pen   = wx.TRANSPARENT_PEN #@UndefinedVariable
            dc.DrawRectangleRect(RectS(self.Size))

        self.PaintMoreBackground(dc, crect)

        # the bounding rectangle of the current line
        rectLine = Rect(0, 0, clientSize.x, 0)

        # iterate over all visible lines
        lineMax = self.GetVisibleEnd()
        lineh    = self.OnMeasureItem
        drawbg   = self.OnDrawBackground
        drawsep  = self.OnDrawSeparator
        drawitem = self.OnDrawItem
        margins  = self.GetMargins()

        for line in xrange(self.GetFirstVisibleLine(), lineMax):
            try:
                hLine = lineh(line)
            except TypeError:
                log.critical('self.OnMeasureItem was None, returning')
                del dc
                return

            rectLine.height = hLine

            # and draw the ones which intersect the update rect
            if rectLine.Intersects(rectUpdate):
                # don't allow drawing outside of the lines rectangle
                clip = DCClipper(dc, rectLine)
                rect = Rect(*rectLine)

                try:
                    drawbg(dc,  Rect(*rect), line)
                except Exception:
                    print_exc()

                try:
                    drawsep(dc, Rect(*rect), line)
                except Exception:
                    print_exc()

                rect.Deflate(margins.x, margins.y)

                try:
                    drawitem(dc, rect, line)
                except Exception:
                    print_exc()
                del clip

            else: # no intersection
                if rectLine.Top > rectUpdate.Bottom:
                    # we are already below the update rect, no need to continue
                    # further
                    break
                else: #the next line may intersect the update rect
                    pass

            rectLine.y += hLine

        return dc
示例#19
0
    def OnRefreshPanel(self, event):
        """
        Refresh dialog box

        """
        import time
        # constants
        backRed: int = 230
        backGreen: int = 255
        backBlue: int = 230  # Background color

        frontRed: int = 64
        frontGreen: int = 0
        frontBlue: int = 64  # Foreground color

        FADE_IN_LENGTH: int = 63
        self.logger.debug(f'Enter OnRefreshPanel')
        # Init memory buffer
        tdc: MemoryDC = MemoryDC()
        tdc.SelectObject(Bitmap(FrameWidth, FrameHeight))
        while not tdc.IsOk():
            time.sleep(0.05)
            tdc = MemoryDC()
            tdc.SelectObject(Bitmap(FrameWidth, FrameHeight))

        tdc.SetTextForeground(Colour(frontRed, frontGreen, frontBlue))
        tdc.SetBackground(
            Brush(Colour(backRed, backGreen, backBlue), BRUSHSTYLE_SOLID))
        tdc.Clear()
        font = tdc.GetFont()
        font.SetFamily(FONTFAMILY_MODERN)
        font.SetPointSize(12)
        tdc.SetFont(font)

        # Fade-in
        position = self.textPosition
        if position < FADE_IN_LENGTH:
            n = float(position) / float(FADE_IN_LENGTH)
            r = backRed - n * (backRed - frontRed)
            g = backGreen - n * (backGreen - frontGreen)
            b = backBlue - n * (backBlue - frontBlue)
            r = int(r)
            g = int(g)
            b = int(b)
            tdc.SetTextForeground(Colour(r, g, b))

        # Display text
        for j in range(1, len(self._textToShow)):
            # Draw text ?
            if position > FADE_IN_LENGTH:
                y = y0 + j * dy - (position - FADE_IN_LENGTH)
                if -dy < y < FrameHeight:
                    tdc.DrawText(self._textToShow[j], x0, y)
            else:  # Draw initial screen with fade in
                y = y0 + j * dy
                if -dy < y < FrameHeight:
                    tdc.DrawText(self._textToShow[j], x0, y)

        # Show memory dc to current dc (blit)
        dc = PaintDC(self._panel)
        dc.Blit(0, 0, FrameWidth, FrameHeight, tdc, 0, 0)
        tdc.SelectObject(NullBitmap)
        self.logger.debug(f'Exit OnRefreshPanel')
示例#20
0
    def Start(self):

        # define colors
        self.colours = {}
        self.colours['bkgd'] = Colour(52, 61, 70)
        self.colours['text'] = Colour(255, 255, 255)
        self.colours['numb'] = Colour(160, 160, 160)
        self.colours['sepr'] = Colour(200, 120, 120)
        self.colours['selbgd'] = Colour(92, 101, 110)
        self.colours['seltxt'] = Colour(255, 255, 255)

        # brushes
        self.brushes = {}
        # normal background
        b = Brush()
        b.SetStyle(BRUSHSTYLE_SOLID)
        b.SetColour(self.colours['bkgd'])
        self.brushes['bkgd'] = b

        # selected background
        b = Brush()
        b.SetStyle(BRUSHSTYLE_SOLID)
        b.SetColour(self.colours['selbgd'])
        self.brushes['selbgd'] = b

        # pens
        self.pens = {}
        p = Pen()
        p.SetColour(self.colours['sepr'])
        p.SetWidth(1)
        p.SetStyle(PENSTYLE_SOLID)
        self.pens['sepr'] = p

        # create device context to work on bitmaps
        dc = MemoryDC()

        # define font
        self.fonts = {}
        f = Font()
        f.SetFamily(FONTFAMILY_ROMAN)
        f.SetFaceName("Monospace")
        f.SetEncoding(FONTENCODING_DEFAULT)
        f.SetStyle(FONTSTYLE_NORMAL)
        f.SetWeight(FONTWEIGHT_NORMAL)
        f.SetUnderlined(False)
        f.SetPointSize(10)
        self.fonts['monospace'] = f

        # select font
        f = 'monospace'

        # get font size
        dc.SetFont(self.fonts[f])
        w, h = dc.GetTextExtent(' ')

        # build character dictionary
        self.rawChars = {}
        # standard printable ascii table
        for c in range(32, 126):
            self.rawChars[chr(c)] = None
        # extra characters (UK)
        self.rawChars['£'] = None
        # save character size
        self.rawChars['Size'] = w, h

        # set background color
        dc.SetBackground(self.brushes['bkgd'])

        # build characters bitmaps
        for C in self.rawChars.keys():
            if C == 'Size': continue
            # instanciate character bitmap
            self.rawChars[C] = Bitmap(w, h, BITMAP_SCREEN_DEPTH)
            # select bitmap
            dc.SelectObject(self.rawChars[C])
            # clear bitmap
            dc.Clear()
            # set text color
            dc.SetTextForeground(self.colours['text'])
            # draw character shape and color
            dc.DrawText(C, 0, 0)
        # done
        dc.SelectObject(NullBitmap)

        # build selected dictionary
        self.selChars = {}
        # standard printable ascii table
        for c in range(32, 126):
            self.selChars[chr(c)] = None
        # extra characters (UK)
        self.selChars['£'] = None
        # save character size
        self.selChars['Size'] = w, h

        # set background color
        dc.SetBackground(self.brushes['selbgd'])

        # build selected bitmaps
        for C in self.selChars.keys():
            if C == 'Size': continue
            # instanciate character bitmap
            self.selChars[C] = Bitmap(w, h, BITMAP_SCREEN_DEPTH)
            # select bitmap
            dc.SelectObject(self.selChars[C])
            # clear bitmap
            dc.Clear()
            # set text color
            dc.SetTextForeground(self.colours['seltxt'])
            # draw character shape and color
            dc.DrawText(C, 0, 0)
        # done
        dc.SelectObject(NullBitmap)

        # create bitmap buffer display and clear buffer
        self.bitmapBuffer = Bitmap(
            128 * w,  # bitmap width
            10 * h,  # bitmap height
            BITMAP_SCREEN_DEPTH)  # bitmap depth
        dc.SelectObject(self.bitmapBuffer)
        dc.SetBackground(self.brushes['bkgd'])
        dc.Clear()
        dc.SelectObject(NullBitmap)

        # reference BackgroundBitmap to bitmapBuffer
        self.Panel.BackgroundBitmap = self.bitmapBuffer

        # adjust frame position
        scrw, scrh = 3840, 1200  # screen size
        w, h = self.Panel.BackgroundBitmap.GetSize()
        self.Frame.SetPosition(Point(scrw / 4 - 128 * 8 / 2, 800))

        # draw text string
        dc.SelectObject(self.bitmapBuffer)

        t = list("hello")
        # select buffer
        # draw text
        X = 0
        w, h = self.rawChars['Size']
        for c in t:
            dc.DrawBitmap(self.rawChars[c], X, 0)
            X += w

        t = list("World!")
        # select buffer
        # draw text
        X = 0
        w, h = self.selChars['Size']
        for c in t:
            dc.DrawBitmap(self.selChars[c], X, h)
            X += w

        # release bitmap
        dc.SelectObject(NullBitmap)

        # done
        return