简体   繁体   中英

Make a button that adapts its size to the text it contains in tkinter

I need the buttons in the following code to resize in order to fit in the text properly. How is it possible? Currently is the text all_definitions_list[0] is wider than the button then the texts gets cropped up.

choice1=Button(newWindow, text=all_definitions_list[0], height=5, width=50, 
command=lambda:wut(choice1, choice2, choice3, choice4, wordLabel))
choice1.place(relx=0.5, rely=y_list[0], anchor=N)

不要使用参数 width=50

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM