MCPcopy Index your code
hub / github.com/PyQt5/PyQt / __init__

Method __init__

Demo/VerificationCode.py:36–52  ·  view source on GitHub ↗
(self, *args, **kwargs)

Source from the content-addressed store, hash-verified

34class WidgetCode(QLabel):
35
36 def __init__(self, *args, **kwargs):
37 super(WidgetCode, self).__init__(*args, **kwargs)
38 self._sensitive = False # 是否大小写敏感
39 self.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
40 self.setBackgroundRole(QPalette.Midlight)
41 self.setAutoFillBackground(True)
42 # 字体
43 newFont = self.font()
44 newFont.setPointSize(16)
45 newFont.setFamily("Kristen ITC")
46 newFont.setBold(True)
47 self.setFont(newFont)
48 self.reset()
49 # 定时器
50 self.step = 0
51 self.timer = QBasicTimer()
52 self.timer.start(60, self)
53
54 def reset(self):
55 self._code = "".join(sample(WORDS, 4)) # 随机4个字符

Callers

nothing calls this directly

Calls 2

resetMethod · 0.95
startMethod · 0.45

Tested by

no test coverage detected