|
|
发表于 2017-11-5 08:53:34
|
显示全部楼层
- import tkinter as tk
- def scrollCall(moveto, pos, units):
- y = frmLst.winfo_y() - int(pos)
- if y>=0: y = 0
- frmLst.place(x=0, y=y)
- root = tk.Tk()
- frm = tk.Frame(root, width=300, height=200, bg='#9f9f9f')
- frm.pack_propagate(0)
- frm.pack()
- scl = tk.Scrollbar(frm, command=scrollCall)
- scl.pack(side='right', fill='y')
- frmLst = tk.Frame(frm, bg='#c0c000')
- btn_ls = [tk.Button(frmLst, text='{:^ 10d}'.format(n))for n in range(15)]
- for btn in btn_ls:
- btn.pack()
- frmLst.pack(anchor='nw')
复制代码 |
|