官术网_书友最值得收藏!

There's more...

If the number of text items is large enough, it may be necessary to add a vertical scroll bar. You can easily connect it using the yscrollcommand option. In our example, we can wrap both widgets in a frame to keep the same layout. Remember to specify the fill option when packing the scroll so that it fills the available space in the y axis:

def __init__(self):
self.frame = tk.Frame(self) self.scroll = tk.Scrollbar(self.frame, orient=tk.VERTICAL) self.list = tk.Listbox(self.frame, yscrollcommand=self.scroll.set) self.scroll.config(command=self.list.yview) # ... self.frame.pack() self.list.pack(side=tk.LEFT) self.scroll.pack(side=tk.LEFT, fill=tk.Y)

Similarly, there is a xscrollcommand option for the horizontal axis.

主站蜘蛛池模板: 平舆县| 工布江达县| 六枝特区| 固原市| 平陆县| 科技| 屯门区| 长春市| 丰顺县| 闻喜县| 万山特区| 彰武县| 祁连县| 洪江市| 明水县| 启东市| 刚察县| 东山县| 开江县| 容城县| 响水县| 宜春市| 荥经县| 陇西县| 西和县| 马公市| 宝应县| 海安县| 海城市| 成武县| 宜城市| 体育| 定襄县| 曲松县| 英超| 平武县| 阳山县| 凤凰县| 宜城市| 乌审旗| 中西区|