python - Is it possible in tkinter to have two columns of labels with one label below and in the middle of them? -


example

while picture shows want do, however:

  1. all labels supposed perfect squares of same size
  2. labels in 2 columns should aligned
  3. the label @ bottom should below , in middle of other two.
  4. the actual labels should solid , there should little space around text of label(text shouldn't take whole label).

grid should used if possible. i'll use python3

yes, of course possible. tkinter arguably has flexible , easy use geometry managers of gui toolkit. pack, place, , grid there no layout can't do.

start piece of paper. seriously. until able visualize this, use paper.

draw 4 equal width columns. divide columns 3 equal-height rows. you'll use lay out.

now, draw labels on top of that. notice on first 2 rows labels occupy columns 1 , 2, , columns 3 , 4. notice on third row label occupies columns 2 , 3.

now, transfer code. tkinter numbers rows , columns starting @ zero, first label row 0, column 0, , spans 2 columns. next label @ row 0, column 2, , spans 2 columns.

the next row done in same way.

for third row label row 2, column 1, , spans 2 columns.

don't forget call grid_rowconfigure , grid_columnconfigure. might want use uniform attribute, example.

to make labels perfect squares, recommend putting each label in frame, setting width of frame whatever size want, , turning geometry propagation off frame sets size of label, rather label setting size of frame. put frames in grid, instead of labels.

you use combination of uniform , minsize options rows , columns, tjough might have problems if labels become big fit. experimentation see works best you.


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -