我正在做作业,但需要你在tkinter中建议定位,我没有任何成功,尝试多种选择,或许你可以给我一个想法:
比例尺应该覆盖我的窗口的全长,但只能居中 为什么?,我需要在不久的将来添加更多尺度而不改变屏幕尺寸。
谢谢
import Tkinter as tk
from random import randint
from Tkinter import *
class MyApplication(Frame):
def __init__(self, master):
Frame.__init__(self, master)
self.grid(row=0,column=1)
self.canvas=tk.Canvas(master, width=400,
height=400,background='white')
self.canvas.grid(row=0,column=0)
label = Label(self, text='Count')
label.grid(row=0,column=2,sticky=(N,S,E,W))
self.sc1 = Scale(self, variable=1, from_=100, to=1)
self.sc1.grid(row=1, column=2, rowspan=1,sticky=(N,S,E,W))
self.sc1.bind("<ButtonRelease-1>")
button = Button(root,text='Start')
button1 = Button(root,text='Stop')
button2 = Button(root,text='Clear')
button.grid(row=400,sticky=(W))
button1.grid(row=400,sticky=(N))
button2.grid(row=400,sticky=(E))
# Main
root = Tk()
app = MyApplication(root)
root.mainloop()