• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python desktop.getRenderer函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中pyui.desktop.getRenderer函数的典型用法代码示例。如果您正苦于以下问题:Python getRenderer函数的具体用法?Python getRenderer怎么用?Python getRenderer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: init

def init():
    pyui.init(width, height, "p3d", fullscreen=0, title="CodeWorld")
    getRenderer().setBackMethod(render)
    getDesktop().registerHandler(pyui.locals.KEYDOWN, keyDown)
    pygame.key.set_repeat(500, 30)

    initGL()
开发者ID:BackupTheBerlios,项目名称:street-svn,代码行数:7,代码来源:Core.py


示例2: destroy

 def destroy(self):
     if self.handle:
         getRenderer().destroyWindow(self.handle)
     self._panel = None            
     self.handle = 0
     self.drawList = []
     Base.destroy(self)
开发者ID:burito,项目名称:PyUI,代码行数:7,代码来源:base.py


示例3: __init__

    def __init__(self, title, text, DialogType): #DialogType 0: Ok - Cancel || 1: Ok

        size = getRenderer().getTextSize(title)
        Dialog.__init__(self, title = title)
        self.setLayout(pyui.layouts.BorderLayoutManager())
        self.textLabel = pyui.widgets.Label(text)
        self.textLabel.setText(text)
        self.buttonPanel = pyui.widgets.Panel()
        self.buttonPanel.setLayout(pyui.layouts.BorderLayoutManager())
        if DialogType == 0:
            self.okButton = pyui.widgets.Button("OK", self._pyuiOK)
            self.okButton.resize(self.innerWidth/2, self.okButton.height)
            self.cancelButton = pyui.widgets.Button("Cancel", self._pyuiCancel)
            self.cancelButton.resize(self.innerWidth/2, self.cancelButton.height)     
            self.buttonPanel.addChild(self.okButton, locals.WEST)
            self.buttonPanel.addChild(self.cancelButton, locals.EAST)
            self.buttonPanel.pack()
        if DialogType == 1:
            self.okButton = pyui.widgets.Button("OK", self._pyuiOK)     
            self.buttonPanel.addChild(self.okButton, locals.SOUTH)
            self.buttonPanel.pack()            
        
        self.addChild(self.textLabel, locals.CENTER)
        self.addChild(self.buttonPanel, locals.SOUTH)

        self.pack()
开发者ID:ieugen,项目名称:Teachingbox,代码行数:26,代码来源:dialogs.py


示例4: resize

 def resize(self, w, h):
     pyui.widgets.Base.resize(self, w,h)
     self.vscroll.resize(getTheme().getScrollerSize(), h)
     self.vscroll.moveto(w-getTheme().getScrollerSize(), 0)
     self.textWidth = self.width - self.vscroll.width
     self.numVisible = self.height / getRenderer().getTextSize("x")[1]
     self.rewrap = 1
开发者ID:burito,项目名称:PyUI,代码行数:7,代码来源:dialogs.py


示例5: scrollToCursor

    def scrollToCursor(self):
        (x,y,w,h) = self.windowRect

        font_width, font_heigth = getRenderer().getTextSize( ' ', self.font )
        grid_width, grid_height = self.getGrid()

        caretPos = self.caretPos + ( 7 * self.text.count( '\t', 0, self.caretPos ) )
        text = self.text.expandtabs( 8 )
        
        row = text.count( '\n', 0, caretPos )
        if row > 0: col = caretPos - text.rfind( '\n', 0, caretPos ) -1
        else: col = caretPos
        
        adj = (caretPos == len( text ) or text[caretPos] == '\n') and 1 or 0
        
        if col - adj < self.scroll[0]:
            self.scroll = max( col - adj, 0 ), self.scroll[1]
        elif col > self.scroll[0] + grid_width:
            self.scroll = col - grid_width, self.scroll[1]
        
        if row < self.scroll[1]:
            self.scroll = self.scroll[0], row
        elif row >= self.scroll[1] + grid_height:
            self.scroll = self.scroll[0], row - grid_height + 1
        
        self.updateScrollBars()
开发者ID:bcamellia,项目名称:PySBD,代码行数:26,代码来源:entry.py


示例6: clear

 def clear(self):
     self.lines = []
     self.displayLines = []
     self.numVisible = self.height / getRenderer().getTextSize("x")[1]
     self.numItems = 0
     self.topItem = 0
     self.rewrap = 0
开发者ID:burito,项目名称:PyUI,代码行数:7,代码来源:dialogs.py


示例7: findMousePos

    def findMousePos(self, pos):
        # put hit position in window relative coords
        x = pos[0] - self.rect[0] - 2
        y = pos[1] - self.rect[1] - 5
        
        font_width, font_heigth = getRenderer().getTextSize( ' ', self.font )
        
        col = max( math.floor( (float(x) / float(font_width)) ) + self.scroll[0], 0 )
        row = max( math.floor( (float(y) / float(font_heigth)) ) + self.scroll[1], 0 )
        
        r, c, i = 0, 0, 0
        while r != row:
            try: i = self.text.index( '\n', i ) + 1
            except: break
            r += 1
        
        while c < col:
            if i >= len( self.text) or self.text[i] == '\n':
                break
            elif self.text[i] == '\t':
                if ( c + 4 > col ): break
                c += 8
            else:
                c += 1
            i += 1

        return min( max( i, 0 ), len( self.text ) )
开发者ID:bcamellia,项目名称:PySBD,代码行数:27,代码来源:entry.py


示例8: __init__

    def __init__( self, text = '' ):
        pyui.widgets.Base.__init__(self)
        self.text = text
        self.caretPos = 0
        self.selectPos = 0
        self.dragging = 0
        self.readonly = 0

        self.font = getRenderer().createFont("courier", 12, 0)
        
        self.scroll = 0, 0
        self.vscroll = pyui.widgets.VScroll()
        self.addChild( self.vscroll )
        self.hscroll = pyui.widgets.HScroll()
        self.addChild( self.hscroll )
        self.registerEvent(pyui.locals.SCROLLPOS, self._pyuiScrollPos)
        
        self.registerEvent(pyui.locals.KEYDOWN, self._pyuiKeyDown)
        self.registerEvent(pyui.locals.KEYUP, self._pyuiKeyUp)
        self.registerEvent(pyui.locals.CHAR, self._pyuiChar)
        self.registerEvent(pyui.locals.LMOUSEBUTTONDOWN, self._pyuiMouseDown)
        self.registerEvent(pyui.locals.LMOUSEBUTTONUP, self._pyuiMouseUp)
        self.registerEvent(pyui.locals.MOUSEMOVE, self._pyuiMouseMotion)
        self.registerEvent(pyui.locals.CLICKED, self._pyuiClicked)
        self.resize( 100, 100 )
开发者ID:bcamellia,项目名称:PySBD,代码行数:25,代码来源:entry.py


示例9: __init__

    def __init__(self, x, y, handler, game):
        pyui.widgets.Button.__init__(self,"",  handler)
        self.registerEvent(RMOUSEBUTTONDOWN, self.onMined)        
        self.x = x
        self.y = y
        self.game = game
        self.reset()
	self.grey = getRenderer().packColor( 150, 150, 50 )
开发者ID:burito,项目名称:PyUI,代码行数:8,代码来源:minesweeper.py


示例10: __init__

 def __init__(self, x, y, w, h, topmost = 0):
     self._panel = Panel()
     Base.__init__(self)
     self.topMost = topmost
     self._panel.moveto(0,0)
     # the content panel is added as a child through Base::addChild to avoid recursively adding it to itself
     Base.addChild(self, self._panel)
     self._panel.setWindow(self)
     self.drawCommands = []
     # these are drawing callbacks to draw _after_ all the widgets are drawn
     self.drawLastCallbacks = [] 
     if self.__dict__.has_key("title"):
         self.handle = getRenderer().createWindow(self.title)
     else:
         self.handle = getRenderer().createWindow("")
     self.moveto(x, y)
     self.resize(w, h)
     getDesktop().addWindow(self)
开发者ID:BackupTheBerlios,项目名称:street-svn,代码行数:18,代码来源:base.py


示例11: __init__

 def __init__(self, handler, text, subMenu):
     self.handler = handler
     self.text = text
     (width, height) = getRenderer().getTextSize(text, getTheme().defaultFont)
     self.width = width
     self.subMenu = subMenu
     self.icon = None
     self.rect = (0,0,0,0)
     self.canActivate = handler or subMenu
开发者ID:burito,项目名称:PyUI,代码行数:9,代码来源:frame.py


示例12: _pyuiMouseMotion

    def _pyuiMouseMotion(self, event):
        if self.moving:
            mouseX = event.pos[0] - self.posX
            mouseY = event.pos[1] - self.posY
            self.frameMove( mouseX - self.startX, mouseY - self.startY)
            getRenderer().moveWindow(self.handle, self.posX, self.posY)
            return 1
        if self.resizing:
            mouseX = event.pos[0] - self.posX
            mouseY = event.pos[1] - self.posY
            if mouseX < 64:
                mouseX = 64
            if mouseY < 64:
                mouseY = 64
            self.frameResize( self.width + mouseX - self.startX, self.height + mouseY - self.startY)
            (self.startX, self.startY) = (mouseX, mouseY)
            return 1

        # set the proper cursor
        regionId = self.hitFrameRegion(event.pos)
        if regionId == pyui.locals.HIT_FRAME_RESIZE_BOTTOM_RIGHT:        
            self.resizingCursor=1
            self.theme.setResizeCursor()
        elif self.resizingCursor:
            self.resizingCursor=0
            self.theme.setArrowCursor()

        if regionId == pyui.locals.HIT_FRAME_MOVE:            
            self.movingCursor = 1
            self.theme.setMovingCursor()
        elif self.movingCursor:
            self.movingCursor = 0
            self.theme.setArrowCursor()
            
        if not self.hit(event.pos):
            if self.resizingCursor and not self.resizing:
                self.resizingCursor=0
                self.theme.setArrowCursor()
            if self.movingCursor and not self.moving:
                self.movingCursor=0
                self.theme.setArrowCursor()
            return 0
        else:
            return 1
开发者ID:burito,项目名称:PyUI,代码行数:44,代码来源:frame.py


示例13: drawMenuBarItem

 def drawMenuBarItem(self, rect, title, selected):
     title = "   " + title + "   "
     (w,h) = getRenderer().getTextSize(title, self.defaultFont)
     if selected:
         getRenderer().drawRect(self.bgColor3, (rect[0], rect[1], w, rect[3]))
         getRenderer().drawText(title, (rect[0], rect[1]), self.fgColor, self.defaultFont)
     else:
         getRenderer().drawText(title, (rect[0], rect[1]), self.fgColor, self.defaultFont)
     return (rect[0], rect[1], w, rect[3])
开发者ID:bcamellia,项目名称:PySBD,代码行数:9,代码来源:comic.py


示例14: drawListBoxItem

 def drawListBoxItem(self, rect, title, selected, color):
     if selected:
         getRenderer().drawRect(self.bgColor3, (rect[0] +2, rect[1] - 1, rect[2]- 1 - 3, rect[3] ))
         getRenderer().drawText(title, (rect[0]+2, rect[1]), self.fgColor, self.defaultFont)
     else:
         getRenderer().drawText(title, (rect[0]+2, rect[1]), color, self.defaultFont)
     return rect
开发者ID:bcamellia,项目名称:PySBD,代码行数:7,代码来源:comic.py


示例15: __init__

 def __init__(self):
     pyui.widgets.Base.__init__(self)
     #self.bgColor = (0,0,49, 255)
     self.lines = []
     self.displayLines = []
     self.numVisible = self.height / getRenderer().getTextSize("x")[1]
     self.numItems = 0
     self.topItem = 0
     self.rewrap = 0
     self.textWidth = 0
     self.vscroll = pyui.widgets.VScroll()
     self.addChild(self.vscroll)
     self.registerEvent(locals.SCROLLPOS, self._pyuiScrollPos)
开发者ID:burito,项目名称:PyUI,代码行数:13,代码来源:dialogs.py


示例16: draw

 def draw(self, renderer):
     #renderer.drawRect(getTheme().bgColor2, self.windowRect)
     if self.rewrap:
         self.rewrapAll()
         self.rewrap = 0
         
     i = 0
     h = getRenderer().getTextSize("x")[1]
     for (line, color) in self.displayLines:
         if i >= self.topItem and i < (self.topItem + self.numVisible):
             renderer.drawText(line, (self.windowRect[0]+2, self.windowRect[1]+2+((i-self.topItem)*h)), color )
         i += 1
     self.vscroll.draw(renderer)
     self.clearDirty()
开发者ID:burito,项目名称:PyUI,代码行数:14,代码来源:dialogs.py


示例17: drawButton

    def drawButton(self, rect, title, hasFocus, status, enabled, font=None, shadow=2, fgColor=0, bgColor=0, roColor=0):
        """Options are:  button title and the up/down status.
        status == 0: normal
        status == 1: rollover
        status == 2: down
        """
        (x,y,w,h) = rect
        if shadow < 2:
            shadow = 2
            
        if not fgColor:
            fgColor = self.buttonTextColor
            
        if not bgColor:
            bgColor = self.buttonUpB

        if not roColor:
            roColor = self.buttonRoA
            
        if status == 0:
            self.draw3DRect(rect, bgColor, 0)
        elif status == 1:
            self.draw3DRect(rect, roColor, 0)
        elif status == 2:
            self.draw3DRect(rect, roColor, 1)
            x += 1
            y += 1

        if not font:
            font=self.defaultFont

        size = getRenderer().getTextSize(title, font)
        
        if shadow:
            getRenderer().drawText( title, (x + (w-size[0])/2+shadow, y + (h-size[1])/2+shadow), self.fgColor, font)            
        getRenderer().drawText( title, (x + (w-size[0])/2, y + (h-size[1])/2), fgColor, font)
        return rect
开发者ID:bcamellia,项目名称:PySBD,代码行数:37,代码来源:comic.py


示例18: drawLabel

    def drawLabel(self, rect, title, color = None, font = None, shadow=0, align=0 ):
        getRenderer().drawRect(self.fgColor, rect)
        getRenderer().drawRect(self.bgColor3, (rect[0]+2, rect[1]+2, rect[2]-4, rect[3]-4) )
        #(title, color) = options
        if not color:
            color = self.fgColor

        if not font:
            font = self.defaultFont
            
        (w,h) = getRenderer().getTextSize(title, font)
        if align == 2:
            posX = rect[0] + rect[2]/2 - w/2
        else:
            posX = rect[0]

        if shadow:
            getRenderer().drawText(title, (posX+shadow, rect[1]+shadow), pyui.colors.black, font)
        getRenderer().drawText(title, (posX, rect[1]), color, font)            
        return (rect[0], rect[1], w, h)
开发者ID:bcamellia,项目名称:PySBD,代码行数:20,代码来源:comic.py


示例19: wrapLine

    def wrapLine(self, line, color):
        """Add a line of text to the display lines list with wrapping."""
        (words, spaces) = self.splitLine(line)

        displayLine = ""
        width = 0
        space = ""
        spaceWidth = 0
        while words:
            word = words.pop(0)
            wordWidth = getRenderer().getTextSize(word)[0]

            if width + spaceWidth + wordWidth <= self.textWidth:
                displayLine = displayLine + space + word
                width += spaceWidth + wordWidth
            else:
                self.addDisplayLine(displayLine, color)
                displayLine = word
                width = wordWidth
            space = spaces.pop(0)
            spaceWidth = getRenderer().getTextSize(space)[0]
                
        if displayLine:
            self.addDisplayLine(displayLine, color)
开发者ID:BackupTheBerlios,项目名称:street-svn,代码行数:24,代码来源:dialogs.py


示例20: drawSliderBar

    def drawSliderBar(self, rect, range, position, BARWIDTH=8):
        interval = rect[2] / float(range)
        half = rect[1] + rect[3]/2
        getRenderer().drawRect(self.bgColor3, rect)
        ## could draw little lines here....
        getRenderer().drawLine( rect[0] + 1, half, rect[0] + rect[2] -2, half, pyui.colors.white)
        getRenderer().drawLine( rect[0] + 1, half + 2, rect[0] + rect[2] -2, half + 2, self.fgColor)
        diff = rect[2] - BARWIDTH
        xpos = float(diff) / range * position
        barHeight = rect[3] - 4
        if barHeight > 20:
            barHeight = 20
            
        self.draw3DRect((rect[0] + xpos, rect[1] + (rect[3]/2) - (barHeight/2), BARWIDTH, barHeight), self.bgColor2, 0)

        getRenderer().drawText("%s/%s" % (position,range), (rect[0] + rect[2] - 40, rect[1]), pyui.colors.red)
        return rect
开发者ID:bcamellia,项目名称:PySBD,代码行数:17,代码来源:comic.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python pyuno.getClass函数代码示例发布时间:2022-05-27
下一篇:
Python desktop.getDesktop函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap