Py学习  »  Python

在python tkinter中有没有调整按钮大小的方法?

권보영 • 5 年前 • 1501 次点击  

在python tkinter中有没有调整按钮大小的方法? 我试图在Python3.7.2Tkinter中使用button.config(width=100,hight=100)调整按钮大小,但它没有正常工作。有办法调整按钮的大小吗?

我使用Python3.7.2和Windows10

    #This is the code that I use.

    import tkinter as tk

    win = tk.Tk()

    #*** Settings ***#
    win.title("Project_title")
    win.geometry("660x450")
    win.resizable(False, False)
    wall = tk.PhotoImage(file = "pictures_gui.gif")
    wall_label = tk.Label(image = wall)
    #*** Settings ***#

    #*** Test code ***#
    def click_me():
        button.configure(text="** I have been clicked")

    button = tk.Button(win,text = "Click me!",command=click_me)
    button.grid(column=1, row=0)
    button.config(width = 100,hight = 100)
    #*** Test code ***#

    win.mainloop()
Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/43360
 
1501 次点击  
文章 [ 1 ]  |  最新文章 5 年前