나는 별도의 기능을 정의했으며 main()
기능을 가지고있다. main()
함수에는 클릭 할 때 다른 함수를 호출하는 여러 개의 버튼이 있습니다. 예.버튼을 연속으로 정렬하는 방법은 무엇입니까?
def main():
global root
global tkinter
global canvas
root = Tk()
root.title("Shapes Quiz - Flow Computing")
Button(root, text ="1", bg="Grey", width=10, command=pentagon).pack()
Button(root, text ="2", bg="Grey", width=10, command=circle).pack()
Button(root, text ="3", bg="Grey", width=10, command=diamond).pack()
Button(root, text ="4", bg="Grey", width=10, command=hexagon).pack()
Button(root, text ="5", bg="Grey", width=10, command=triangle).pack()
Button(root, text ="6", bg="Grey", width=10, command=square).pack()
Button(root, text ="7", bg="Grey", width=10, command=rectangle).pack()
Button(root, text ="8", bg="Grey", width=10, command=heptagon).pack()
Button(root, text ="9", bg="Grey", width=10, command=octagon).pack()
Button(root, text ="10", bg="Grey", width=10, command=oval).pack()
Button(root, text ="Help", bg="Grey", width=10, command=help).pack()
Button(root, text ="Clear", bg="Red", width=10, command=clearshapes).pack()
Button(root, text ="QUIT", bg="Red", width=10, command=quit).pack()
이러한 버튼을 구성하는 더 쉬운 방법이 있어야합니다. 저는 프레임과 그리드, 심지어 좌표의 사용에 대해서도 들었습니다. 그러나 나는 이것을하는 방법을 여전히 확신 할 수 없다.
나는 그들이 현재 나타나는대로 그들은 수평하지 수직을 그래서 버튼을 구성하고 싶습니다.
다른 링크 몇 개 : http://effbot.org/tkinterbook/tkinter-index.htm http://effbot.org/tkinterbook/grid.htm – codeape
수정되었지만이 자습서는 답변을 제공하지 않습니다. 찾고, 그것은 여러 개의 버튼을 정렬하는 방법을 말하지 않습니다. –
codeape의 링크는 좀 더 많은 정보를 제공합니다. 읽을거야. –