Back to Browse

3 Python Tkinter Geometry Layout Managment

5.9K views
Apr 19, 2018
8:42

Source Codes: https://codeloop.org/category/tkinter-tutorials/ This is our third video in Tkinter gui application development with python3 in this video we are going disscuss about 3 diffrent layout geometry manager in tkinter 1 - Pack Geometry Manager The pack manager can be a bit tricky to explain in words, and it can best be understood by playing with the code base. Fredrik Lundh, the author of Tkinter, asks us to imagine the root as an elastic sheet with a small opening at the center. The pack geometry manager makes a hole in the elastic sheet that is just large enough to hold the widget. The widget is placed along a given inner edge of the gap (the default is the top edge). It then repeats the process till all the widgets are accommodated. Finally, when all the widgets have been packed in the elastic sheet, the geometry manager calculates the bounding box for all the widgets. It then makes the parent widget large enough to hold all the child widgets. When packing the child widgets, the pack manager distinguishes between the following three kinds of space: • The unclaimed space • The claimed but unused space • The claimed and used space 2 - Grid Geometry Manager The grid geometry manager is easy to understand and perhaps the most useful geometry manager in Tkinter. The central idea of the grid geometry manager is to organize the container frame into a two-dimensional table, which is divided into a number of rows and columns. Each cell in the table can then be targeted to hold a widget. In this context, a cell is an intersection of imaginary rows and columns. Note that in the grid method, each cell can hold only one widget. However, widgets can be made to span multiple cells. Within each cell, you can further align the position of the widget using the sticky option. The sticky option decides how the widget is expanded. If its container cell is using one or more of the N, S, E, and W options or the NW, NE, SW, and SE options. Not specifying stickiness defaults to stickiness to the center of the widget in the cell. 3 - Place Geometry Manager The place geometry manager is the most rarely used geometry manager in Tkinter. Nevertheless, it has its uses in that it lets you precisely position widgets within its parent frame by using the (x,y) coordinate system. Complete Video Tutorial For PyQt5 Application Development https://www.youtube.com/watch?v=pnpL9Sl79g8&list=PL1FgJUcJJ03uwFW8ys2ov2dffKs3ieGYk Pyglet Tutorial For Multimedia Applications And Game Development https://www.youtube.com/watch?v=lJQ3UgcDHto&list=PL1FgJUcJJ03s7kYUy40ydTA9gBnj_KDlK Python Opengl Programming With Pyopengl https://www.youtube.com/watch?v=AQ1JPbWgWpc&list=PL1FgJUcJJ03s_nmCAA7F5rv7QDOp-V6kn Python Pyglet Application Development Tutorial https://www.youtube.com/watch?v=ZKbZzK4BHX4&t=35s

Download

0 formats

No download links available.

3 Python Tkinter Geometry Layout Managment | NatokHD