# 如下代码,sg.popup控件会根据当前的self.window的位置和大小,自适应显示在相应的位置
def my_popup(self, title, message, auto_close=False, auto_close_duration=3):
"""弹出提示框"""
x, y = self.window.current_location()
w, h = self.window.size
lw = w // 30 # line width
dx = w // (lw / 4) # distance from center of screen to popup
if len(message) < lw:
half_w = (lw - len(message)) // 2
message = ('>' * half_w) + message + ('<' * half_w)
sg.popup(title, message, line_width=lw, location=(x + w//2 - dx, y + h//3),
auto_close=auto_close, auto_close_duration=auto_close_duration)
"""
其中:
(w, h) 为 (580, 420)
lw = w // 30,这个30需要自行调整数值
dx = w // (lw / 4),这个4也需要自行调整
"""
09-13
2412
12-31
4627
12-15
7487
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交