0

i m getting the song name from a directory , and it song names shows on a button text , but if song name is so large then it will cutoff some letters from start

def choose_file(ft):

    a = filedialog.askdirectory(initialdir="~\Music",title="Choose a Folder")
    a = a.replace("/", "//")
    print(a)
    l = ctk.CTkScrollableFrame(ft,fg_color="#0b2636",width=370,height=530)
    l.pack(pady=10)
    file_list = [x for x in os.listdir(rf"{a}") if x.split(".")[-1] in ['mp3', 'ogg', 'wav']]
    for file in file_list:
        b = ctk.CTkButton(l,text=file,width=386,corner_radius=0,fg_color="#071924",hover_color="#12405c",anchor="e")
        b.bind("<Button-1>",lambda event:get_song(event,ft,a))
        b.pack(pady=2)

the song name should display on button from left side without cutting of some start letter end letter can be cut off

Bryan Oakley
  • 370,779
  • 53
  • 539
  • 685
  • 1
    It would be best if you could create a [mcve] that had some hard-coded data. We don't have the same files and folders that you do. – Bryan Oakley Jul 17 '23 at 13:25

0 Answers0