Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use system default icons in Tkinter and Python3

I want to use the systems default icons for known task (copy, cut, paste, filenew, fileopen, exit, help, ...). This depends on the current used icon set in the desktop environment and/or on the used operating system.

Does Python offer a plattform independed way to get such icons?

Here is some Tkinter-based pseudocode

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from tkinter import *
from tkinter import ttk
from PIL import *

root = Tk()

image = image.open(DEFAULT_COPY_ICON)
image = ImageTk.PhotoImage(image)

button = Button(master=root, text='Copy', image=image))

root.mainloop()
like image 359
buhtz Avatar asked Jan 31 '26 16:01

buhtz


1 Answers

Python3 or Tkinter does not offer a way for this.

like image 57
buhtz Avatar answered Feb 02 '26 08:02

buhtz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!