How do I change button size in Python?

前端 未结 2 1614
别跟我提以往
别跟我提以往 2020-12-16 10:16

I am doing a simple project in school and I need to make six different buttons to click on. The buttons must have different sizes, but I can\'t find how do do it. I have mad

2条回答
  •  不知归路
    2020-12-16 10:23

    Configuring a button (or any widget) in Tkinter is done by calling a configure method "config"

    To change the size of a button called button1 you simple call

    button1.config( height = WHATEVER, width = WHATEVER2 )
    

    If you know what size you want at initialization these options can be added to the constructor.

    button1 = Button(self, text = "Send", command = self.response1, height = 100, width = 100) 
    

提交回复
热议问题