更改tk组合框下拉滚动条的宽度 [英] Change width of tk Combobox dropdown scrollbar

查看:183
本文介绍了更改tk组合框下拉滚动条的宽度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在python 2.7中更改tk组合框向下滚动条的宽度?我不是在说组合框的宽度,而是在组合框处于活动状态时出现的组合框上的滚动条宽度.例如:

Is it possible to change the width of a tk Combobox scrolldown bar in python 2.7? I'm not talking about the combobox width, but rather the scrollbar width on the combobox that appears when the combobox is active. For example:

self.cmbSortOrder=ttk.Combobox(self.frame2, value=l, textvariable=self.SortOrder)
self.cmbSortOrder.bind("<<ComboboxSelected>>", self.reloadList)
self.cmbSortOrder.pack(side=LEFT)

推荐答案

Combobox小部件利用Scrollbar小部件,因此可以通过Combobox小部件的实例观察到更改Scrollbar小部件的样式.下面的一个粗略示例显示了这一点:

The Combobox widget leverages the Scrollbar widget, thus changing the style of the Scrollbar widget will be observable by instances of the Combobox widget. A crude example below shows this:

# Create a style instance
style = ttk.Style()

# Specify style the preference(s) for combo box widgets
style.configure( 'TCombobox', arrowsize=25 )

# Alter the template properties of the scroll bar to affect the Combobox widget
style.configure( 'Vertical.TScrollbar', width=22 )
style.configure( 'Vertical.TScrollbar', arrowsize =22 )
style.configure( 'Vertical.TScrollbar', arrowsize =22 ) 

这篇关于更改tk组合框下拉滚动条的宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆