Nov-01-2020, 01:03 PM
Hey there!
I'm making a program manager with Tkinter and I want to set the background image of the Text widget which contains the buttons to an image.
Here is the code:
Output:
I hope you can understand what I mean, thanks for all the help!
I'm making a program manager with Tkinter and I want to set the background image of the Text widget which contains the buttons to an image.
Here is the code:
from tkinter import * import os def command(d): print(d) a = Tk() scroll = Scrollbar(a, orient="vertical") text = Text(a, width=20, height=15, wrap="none", yscrollcommand=scroll.set) scroll.place(x=0, y=0, height=270, anchor='nw') text.place(x=15, y=0, anchor='nw') scroll.configure(command=text.yview) b = [] c = [] DEBUG = {} DEBUG['random'] = ['hhwher', 'fgiwue', 'ewhrgj', 'wrejkh', 'fkhejw', 'qhkwje', 'hsajkd', 'asjkdh', 'haksdj', 'hadjsg', 'kdjsha', 'hkadjs', 'rweyiu', 'jdkhsa'] for x in range(len(os.listdir())): if os.path.isfile(os.listdir()[x]): b.append(os.listdir()[x]) if os.path.isdir(os.listdir()[x]): c.append(os.listdir()[x]) b = DEBUG['random'] for x in b: x = Button(text, text=x, anchor='e', bg='black', font=('DIN Alternate', '15'), width=15, command=lambda j=x: command(j)) text.window_create("end", window=x) text.insert("end", "\n") text.configure(state=DISABLED) a.mainloop()(You can remove all the code containing the DEBUG variable.)
Output:
I hope you can understand what I mean, thanks for all the help!