-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Description
I have this code in a class that generates a frame for each mp3 file in a list. These frames are added to a scrollable frame.
class Playable(CTkFrame):
def __init__(self, master:any, controller:UiController, pm:PlayableMeta):
super().__init__(master)
self.pm = pm
self.controller = controller
self.grid_rowconfigure((0, 1), weight=1)
self.columnconfigure(index=0, weight=1)
self.columnconfigure(index=1, weight=5)
self.columnconfigure(index=2, weight=1)
self.lbl_title = CTkLabel(self,
text=pm.title,
font=("Arial", 28), anchor="nw")
self.lbl_artist = CTkLabel(self,
text=pm.artist,
font=("Arial", 16), anchor="nw")
self.lbl_length = CTkLabel(self,
text="00:00.000",
font=("Arial", 16), bg_color="#228B22", anchor="e", padx=5, pady=5)
self.lbl_start = CTkLabel(self,
text="00:00.000",
font=("Arial", 16), bg_color="#444", text_color="#999", anchor="e", padx=5, pady=5)
if pm.start > 0:
self.lbl_start.configure(bg_color="#FF6347", text_color="white")
PositionStuff.full_sticky_mid_pad(self.lbl_title, row=0, col=1 )
PositionStuff.full_sticky_mid_pad(self.lbl_artist, row=1, col=1)
PositionStuff.full_sticky_mid_pad(self.lbl_length, row=0, col=2 )
PositionStuff.full_sticky_mid_pad(self.lbl_start, row=1, col=2 )
class PositionStuff:
@staticmethod
def full_sticky(panel, row=0, col=0):
return panel.grid(row=row, column=col, sticky="nsew", padx=10, pady=10)
@staticmethod
def full_sticky_mid_pad(panel, row=0, col=0):
return panel.grid(row=row, column=col, sticky="nsew", padx=5, pady=5)
@staticmethod
def full_sticky_no_pad(panel, row=0, col=0):
return panel.grid(row=row, column=col, sticky="nsew")
When I run this code with an example of two mp3 files, the labels and titles are rendered in different positions:
In the bottom frame the title is shifted to the left and the labels are shorter.
I am confused, as of why?
The text is more or less the same length.
If I add the hint I've found on the Internettz:
self.grid_propagate(False)
This happens:
...which is absolutely not want I expected.
Is there a way to enforce the grid to be "fixed" in width and height?
Metadata
Metadata
Assignees
Labels
No labels