Grid within a frame?

前端 未结 2 906
北恋
北恋 2020-12-18 01:02

Is it possible to place a grid of buttons in Tkinter inside another frame?

I\'m wanting to create a tic-tac-toe like game and want to use the grid feature to put ga

2条回答
  •  天命终不由人
    2020-12-18 01:21

    You can nest Tk widgets arbitrarily deep. Quoth the manual:

    The size of any master widget is determined by the size of the “slave widgets” inside. The packer is used to control where slave widgets appear inside the master into which they are packed. You can pack widgets into frames, and frames into other frames, in order to achieve the kind of layout you desire. Additionally, the arrangement is dynamically adjusted to accommodate incremental changes to the configuration, once it is packed.

    Indeed, a frame containing a (frame of buttons) and a label is how you must structure the layout you describe.

提交回复
热议问题