Transparent letters in Tkinter?

Thread Solved

Join Date: Jun 2006
Posts: 187
Reputation: Matt Tacular is an unknown quantity at this point 
Solved Threads: 7
Matt Tacular's Avatar
Matt Tacular Matt Tacular is offline Offline
Unverified User

Transparent letters in Tkinter?

 
0
  #1
Feb 17th, 2007
I have an image being displayed in a Tkinter window. I need a way to add letters to the image in certain spots depending on what is done by the user. Example: if button 1 is pressed, the peoples names appear over their heads, but I can't just switch the image for a new one with the names there. I need to be able to make it so the user could enter in the name of the person, and then THAT name will appear over top of the persons head.

Any ideas how this could be done? And I the title is transparent letters because it would be awesome if the text didn't have a white background or boarder or anything like that.

Thanks for your help in advance everyone!
Reply With Quote Quick reply to this message  
Join Date: Jun 2006
Posts: 187
Reputation: Matt Tacular is an unknown quantity at this point 
Solved Threads: 7
Matt Tacular's Avatar
Matt Tacular Matt Tacular is offline Offline
Unverified User

Re: Transparent letters in Tkinter?

 
0
  #2
Feb 18th, 2007
Ok, it doesn't have to have any transparency, but is there any way to easily add text over top of an image being displayed in tkinter? Even if it does have a white boarder or box, etc, that's fine.
Reply With Quote Quick reply to this message  
Join Date: Sep 2005
Posts: 133
Reputation: mawe is an unknown quantity at this point 
Solved Threads: 58
mawe mawe is offline Offline
Junior Poster

Re: Transparent letters in Tkinter?

 
0
  #3
Feb 18th, 2007
Hi!

If you do all this in a Canvas, that's very easy:
  1. import Tkinter as tk
  2.  
  3. root = tk.Tk()
  4. c = tk.Canvas()
  5. c.pack()
  6.  
  7. # the image
  8. image = PhotoImage(file="whatever.gif")
  9. c.create_image(0, 0, image=image)
  10.  
  11. # and now the text at coordinates (50, 50)
  12. c.create_text(50, 50, text="whatever", fill="blue")
  13.  
  14. root.mainloop()

Regards, mawe
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Python Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC