Why my image buttons are not appearing?

前端 未结 2 1085
广开言路
广开言路 2021-01-21 22:29

I am trying to place two image buttons on my image background in a certain position, but my buttons are not appearing. I think their images are behind the background.

I

2条回答
  •  一整个雨季
    2021-01-21 23:08

    In addition to keeping a reference to the image, you have a problem with this line:

    self.grid()
    

    in the __init__ method of Application. It's gridding the Frame into the window, but since nothing is ever packed or gridded into the frame, it doesn't ever expand past a little, tiny frame, so you just don't see the Buttons inside it. A simple fix here would be the pack method, with arguments to fill the window and expand when needed:

    self.pack(fill=BOTH, expand=1)
    

提交回复
热议问题