This works for me
import tkinter as tk import os from functools import partial def print_selected(var): label['font'] = ('times', 30) label['text'] = var suites = ['heart', 'diamond', 'club', 'spade'] img_dir = os.getcwd() print(img_dir) root = tk.Tk() root.title('Card Suites') root.geometry('800x450+250+250') col = 0 option = tk.StringVar() option.set(suites[0]) for suite in suites: suite_img = tk.PhotoImage(file=f'{img_dir}\images\{suite}.png') suite_img.img = suite_img radio = tk.Radiobutton(root, image=suite_img, value=suite, var=option, \ command=partial(print_selected, suite), indicatoron=0) radio.grid(row=0, column=col) col += 1 label = tk.Label(root) label['text'] = 'default text' label.grid(column=0, row=1, rowspan=4) root.mainloop()output for img_dir
Output:C:\Users\John Doe\Desktop\cards
I welcome all feedback.
The only dumb question, is one that doesn't get asked.
My Github
How to post code using bbtags
The only dumb question, is one that doesn't get asked.
My Github
How to post code using bbtags