本文整理汇总了Python中label.Label.setPosition方法的典型用法代码示例。如果您正苦于以下问题:Python Label.setPosition方法的具体用法?Python Label.setPosition怎么用?Python Label.setPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类label.Label
的用法示例。
在下文中一共展示了Label.setPosition方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Tab
# 需要导入模块: from label import Label [as 别名]
# 或者: from label.Label import setPosition [as 别名]
class Tab(BasicContainer,MouseListener):
def __init__(self,caption=""):
BasicContainer.__init__(self)
self.mHasMouse=False
self.mTabbedArea=None
self.mLabel=Label()
self.mLabel.setPosition(4,4)
self.setCaption(caption)
self.add(self.mLabel)
self.addMouseListener(self)
self.addFocusListener(self)
def adjustSize(self):
self.setSize(self.mLabel.getWidth()+8, self.mLabel.getHeight()+8)
if self.mTabbedArea != None:
self.mTabbedArea.adjustTabPositions()
self.addDirtyRect()
def setTabbedArea(self,tabbedArea):
self.mTabbedArea=tabbedArea
def getTabbedArea(self):
return self.mTabbedArea
def setCaption(self,caption):
self.mLabel.setCaption(caption)
self.mLabel.adjustSize()
self.adjustSize()
def getCaption(self):
return self.mLabel.getCaption()
def draw(self,graphics):
faceColor = self.getBaseColor()
alpha=faceColor.a
highlightColor=faceColor+0x303030
highlightColor.a=alpha
shadowColor=faceColor-0x303030
shadowColor.a=alpha
borderColor, baseColor = None, None
if (self.mTabbedArea != None and self.mTabbedArea.isTabSelected(self) == True) or self.mHasMouse:
#Draw a border.
graphics.setColor(highlightColor)
graphics.drawLine(0, 0, self.getWidth()-1, 0)
graphics.drawLine(0, 1, 0, self.getHeight()-1)
graphics.setColor(shadowColor)
graphics.drawLine(self.getWidth()-1, 1, self.getWidth()-1, self.getHeight()-1)
borderColor=Color(highlightColor)
baseColor=Color(self.getBaseColor())
else:
#draw a border
graphics.setColor(shadowColor)
graphics.drawLine(0, 0, self.getWidth()-1, 0)
graphics.drawLine(0, 1, 0, self.getHeight()-1)
graphics.drawLine(self.getWidth()-1, 1, self.getWidth()-1, self.getHeight()-1)
baseColor=self.getBaseColor() - 0x151515
baseColor.a=alpha
#Push a clip area so the other drawings don't need to worry
#about the border.
graphics.pushClipArea( Rectangle(1, 1, self.getWidth() - 2, self.getHeight() - 1) )
currentClipArea=Rectangle( graphics.getCurrentClipArea() )
graphics.setColor(baseColor)
graphics.fillRectangle( Rectangle(0,0,self.getWidth(), self.getHeight()) )
self.drawChildren(graphics)
if self.mTabbedArea != None and self.mTabbedArea.isFocused() == True and self.mTabbedArea.isTabSelected(self) == True:
graphics.setColor( self.getForegroundColor() )
graphics.drawRectangle( Rectangle(2,2,currentClipArea.width-4,currentClipArea.height-4) )
graphics.popClipArea()
def mouseEntered(self,mouseEvent):
self.mHasMouse=True
self.addDirtyRect()
def mouseExited(self,mouseEvent):
self.mHasMouse=False
self.addDirtyRect()