Changing the shape of tkinter widgets

前端 未结 1 625
逝去的感伤
逝去的感伤 2021-01-24 03:40

So I have a simple button:

f1button3=Button(text=\"Database\", command = lambda: DatabaseWidgets()).place(x=1,y=30)

The buton is always a recta

相关标签:
1条回答
  • 2021-01-24 04:09

    I hit the same problem. My solution was to use an image, then bind that to a click. Here is the code I used:

    from Tkinter import *
    from PIL import ImageTk, Image
    
    app = Tk()
    
    def do(event):
        print("Button Clicked!")
        #...
    
    img = ImageTk.PhotoImage(Image.open("Button.gif"))
    button = Label(app, image = img)
    button.pack()
    
    button.bind('<Button-1>', do)
    
    app.mainloop()
    

    The <Button-1> binds the image to a right click. The "Button.gif" is the picture I used.

    Here is the output picture:

    0 讨论(0)
提交回复
热议问题