[Tkinter-discuss] Add text to desktop

Michael Lange klappnase at web.de
Thu May 26 06:11:17 EDT 2016


Hi,

On Thu, 26 May 2016 09:36:16 +0200
Paul Malherbe <paul at tartan.co.za> wrote:

> You could use canvas to achieve this as per attached snippet.

with a few modifications, your example can be used to actually look like
a desktop wallpaper:

#####################################################
import Tkinter as tk
import ttk
from PIL import Image, ImageTk

root = tk.Tk()

w, h = root.winfo_screenwidth(), root.winfo_screenheight()
root.geometry('%dx%d+0+0' % (w, h))
root.wm_overrideredirect(1)
root.lower()

pilimg = Image.open("example.gif")
rimage = pilimg.resize((w, h), Image.ANTIALIAS)
fimage = ImageTk.PhotoImage(image=rimage)
cnv = tk.Canvas(root)
cnv.create_image(0, 0, image=fimage, anchor="nw", tags="img")
cnv.create_text(200, 100, text="HELLO BABY", font=("Arial", 20, "bold"))
cnv.pack(side="left", fill="both", expand="yes")
root.mainloop()
###################################################

However, as soon as you call something like "pcmanfm --desktop" to get
desktop icons your Tkinter "wallpaper" will be hidden underneath.

Regards

Michael


.-.. .. ...- .   .-.. --- -. --.   .- -. -..   .--. .-. --- ... .--. . .-.

I object to intellect without discipline;  I object to power without
constructive purpose.
		-- Spock, "The Squire of Gothos", stardate 2124.5


More information about the Tkinter-discuss mailing list