本文整理汇总了Python中dice.Dice.get_dice_roll方法的典型用法代码示例。如果您正苦于以下问题:Python Dice.get_dice_roll方法的具体用法?Python Dice.get_dice_roll怎么用?Python Dice.get_dice_roll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dice.Dice
的用法示例。
在下文中一共展示了Dice.get_dice_roll方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Gui
# 需要导入模块: from dice import Dice [as 别名]
# 或者: from dice.Dice import get_dice_roll [as 别名]
#.........这里部分代码省略.........
self.push_button_attr(str(self.attr3_p5), wid, 260, 210)
self.push_button_attr(str(self.attr4_p5), wid, 385, 210)
self.push_button_attr(str(self.attr5_p5), wid, 510, 210)
self.push_button_attr(str(self.attr6_p5), wid, 635, 210)
self.push_button_attr(str(self.attr7_p5), wid, 760, 210)
self.push_button_name(str(self.name_p6), wid, 25, 150)
self.push_button_attr(str(self.attr1_p6), wid, 10, 210)
self.push_button_attr(str(self.attr2_p6), wid, 135, 210)
self.push_button_attr(str(self.attr3_p6), wid, 260, 210)
self.push_button_attr(str(self.attr4_p6), wid, 385, 210)
self.push_button_attr(str(self.attr5_p6), wid, 510, 210)
self.push_button_attr(str(self.attr6_p6), wid, 635, 210)
self.push_button_attr(str(self.attr7_p6), wid, 760, 210)
if roll is not None:
self.push_button_dice(str(roll), wid, 775, 25)
else:
pass
wid.show()
return
def create_widget(self):
global mw
wid = QtGui.QWidget(mw)
wid.resize(960, 1080)
wid.setWindowTitle('Cthulhu')
p = wid.palette()
p.setColor(wid.backgroundRole(), QtCore.Qt.lightGray)
wid.setPalette(p)
return wid
def push_button_dice(self, dice, parent, x , y):
'''
:param x:
:param y:
:param parent:
:param name:
:param function:
:return:
'''
qbtn = QtGui.QPushButton(dice, parent)
qbtn.setStyleSheet("QPushButton { font-size: 32pt }" )
qbtn.clicked.connect(lambda: self.dice_roll(dice, parent))
qbtn.resize(100, 100)
qbtn.move(x, y)
return qbtn
def push_button_name(self, dice, parent, x , y):
'''
:param x:
:param y:
:param parent:
:param name:
:param function:
:return:
'''
qbtn = QtGui.QPushButton(dice, parent)
qbtn.setStyleSheet("QPushButton { font-size: 32pt }" )
qbtn.clicked.connect(lambda: self.do_nothing())
qbtn.resize(850, 50)
qbtn.move(x, y)
return qbtn
def push_button_attr(self, dice, parent, x , y):
'''
:param x:
:param y:
:param parent:
:param name:
:param function:
:return:
'''
qbtn = QtGui.QPushButton(dice, parent)
qbtn.setStyleSheet("QPushButton { font-size: 30pt }" )
qbtn.clicked.connect(lambda: self.do_nothing())
qbtn.resize(115, 70)
qbtn.move(x, y)
return qbtn
def dice_roll(self, dice, parent):
roll = self.dice.get_dice_roll(dice)
parent.hide()
self.gui(roll)
return
def do_nothing(self):
return