gpt4 book ai didi

python - 使 Tkinter 组合框滚动条和箭头按钮更大

转载 作者:行者123 更新时间:2023-12-04 15:27:07 24 4
gpt4 key购买 nike

有没有办法让 tkinter 组合框滚动条和箭头变大??那里的箭头非常小,尝试了高度和宽度,没有帮助 Image of the gui

最佳答案

您需要配置组合框的样式才能做到这一点。下面的代码按照您的要求执行。

import tkinter as tk
import tkinter.ttk as ttk


class App(tk.Tk):
def __init__(self):
super().__init__()
self.rowconfigure(0, weight=1)
self.columnconfigure(0, weight=1)
self.title('Default Demo')
self.geometry('420x200')

style = ttk.Style() #If you dont have a class, put your root in the()
style.configure('TCombobox', arrowsize=30)
style.configure('Vertical.TScrollbar', arrowsize=28)
values = []
for idx in range(1, 50):
values.append(f'Testing-{idx}')

cbo = ttk.Combobox(self, values=values)
cbo.grid(ipady=5)


def main():
app = App()
app.mainloop()


if __name__ == '__main__':
main()

关于python - 使 Tkinter 组合框滚动条和箭头按钮更大,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62029097/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com