pyos.py 文件源码

python
阅读 34 收藏 0 点赞 0 评论 0

项目:PythonOS 作者: furmada 项目源码 文件源码
def __init__(self, position, text, bgColor=DEFAULT, textColor=DEFAULT, textSize=DEFAULT, **data):
            #Defaults are "darker:background", "item", and 14.
            bgColor, textColor, textSize = GUI.Component.default(bgColor, state.getColorPalette().getColor("darker:background"),
                                  textColor, state.getColorPalette().getColor("item"),
                                  textSize, 14)
            self.textComponent = GUI.Text((0, 0), text, textColor, textSize, font=data.get("font", state.getFont()), freetype=data.get("freetype", False))
            self.paddingAmount = data.get("padding", 5)
            if "width" not in data: data["width"] = self.textComponent.computedWidth + (2 * self.paddingAmount)
            if "height" not in data: data["height"] = self.textComponent.computedHeight + (2 * self.paddingAmount)
            super(GUI.Button, self).__init__(position, **data)
            self.SKIP_CHILD_CHECK = True
            self.textComponent.setPosition(GUI.getCenteredCoordinates(self.textComponent, self))
            self.backgroundColor = bgColor
            self.addChild(self.textComponent)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号