sf = Pmw.ScrolledFrame(root, labelpos=N, label_text="Scrolled Frame", hull_width=300, hull_height=200, usehullsize=1, borderframe=1) f = sf.interior() sf.pack() for i inrange(9): fm = Frame(f) fm.pack(anchor=NW) y = i+1 for j inrange(y): btn = Button(fm, text="%d x %d" % (i+1, j+1), bg="moccasin", borderwidth=1, command=lambda a=i+1, b=j+1: calc(a, b)) btn.pack(side=LEFT) sf.component("frame").configure(bg="linen") root.mainloop()
插曲
使用阿里云PYPI下载PMW,类似如下报错
PS C:\Users\Admin> pip install Pmw Looking in indexes: https://mirrors.aliyun.com/pypi/simple WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', FileNotFoundError(2, 'No such file or directory'))': /pypi/simple/pmw/ WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', FileNotFoundError(2, 'No such file or directory'))': /pypi/simple/pmw/ WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', FileNotFoundError(2, 'No such file or directory'))': /pypi/simple/pmw/ WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', FileNotFoundError(2, 'No such file or directory'))': /pypi/simple/pmw/ WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', FileNotFoundError(2, 'No such file or directory'))': /pypi/simple/pmw/ ERROR: Could not find a version that satisfies the requirement Pmw (from versions: none)