Tkinter grid layout question

Phil <[email protected]>
Newsgroups gmane.comp.python.tutor
Message-ID <[email protected]>
This a customtkinter project but I expect the grid layout works exactly 
the same in standard Tkinter.

The aim is to display an image at the top left of the window and four 
direction buttons in a cross formation centred on the image and to the 
right of the image.

I've got this working through a trial and error but I'd like to know how 
I should have arrived at the same solution without all the fuss. 
Gradually increasing the label rowspan finally led to the solution.

I have a large label defined and displayed as follows:

         my_image = customtkinter.CTkImage(
             dark_image=Image.open("background.png"), size=(250, 230)
         )


         image_label = customtkinter.CTkLabel(self, image=my_image, 
text="",fg_color="yellow")
         image_label.grid(row=0, column=0, rowspan=18, padx=10, pady=10, 
sticky="nw")

The four direction arrow buttons are as follows (I'll just show one):

         up_arrow_image = customtkinter.CTkImage(
             dark_image=Image.open("up.png"), size=(40, 40)


         up_button = customtkinter.CTkButton(
             self, text="", image=up_arrow_image, width=50, height=50
         )

         up_button.grid(row=0, column=4, pady=(40,0),sticky="ne")

The up_button pady=(40,0) shifts the group of buttons down so that 
they're centred to the right of the label.

I'm not confident that I've attacked the problem correctly but if the 
solution is correct then all is well.
-- 

Regards,
Phil

_______________________________________________
Tutor maillist  -  [email protected]
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.