【发布时间】:2022-07-08 02:31:14
【问题描述】:
n = int(input())
def call_back(self):
pass
self.layout = GridLayout(cols=n, rows=n,
size_hint = (0.5625, 1),
pos_hint={'center_x': 0.5, 'center_y': 0.5})
for _ in range(n ** 2):
b = Button(on_press=self.call_back,
background_color=(25, 25, 25, 1))
return self.layout
call_back 函数应该返回按下的按钮坐标,但我不知道如何实现
【问题讨论】:
-
您可以尝试在单击按钮时获取position of the mouse。