Hi, Thus spoketh Wayne Werner <waynejwer...@gmail.com> unto us on Tue, 21 Dec 2010 15:04:49 -0600:
> Hi, > > Is it possible to create say, a checkbutton widget with a transparent > background? I'm trying to take an image and put some checkbuttons on it > so I can mark certain locations (like on a map). I'll be using the > canvas widget and placing the checkbuttons on the canvas, but when I do > they have the horrid background. I can change the color of the > background, but I would much prefer having a transparent one. > > Is this possible to do with the standard widgets or do I have to roll my > own? > I don't think there is support for background transparency in Tk. The best bet is probably to try something like this: from Tkinter import * root = Tk() img_off = PhotoImage( data='R0lGODlhFQANAKEAAJaWlu/v7////////yH5BAEAAAMALAAAAAAVAA0AAAIyhI8Ww80Jw3LNiI' 'uxpBXkv3GD9WkTR5ZCiHrqelJpycquWjszGOs33etIhsRcpYgMMgoAOw==') img_on = PhotoImage( data='R0lGODlhFQANAMIAAJaWlu/v7////wAAAP///////////////yH5BAEAAAQALAAAAAAVAA0AAANACLq' 'sQTDCRsOTUYnNucUZIAwDRwofSGhk2aIXqI1tCauruL1bKus1mw/DOr2GkqKphAx1ns0JwEKtRlfWbAyTAAA7') c = Checkbutton(root, indicatoron=False, image=img_off, selectimage=img_on, bd=0, selectcolor='', width=12, height=12) c.pack(padx=100, pady=100) root.mainloop() If you need text next to the checkbutton, you can create a canvas text element, instead of using the checkbutton's text option. Regards Michael .-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-. You'll learn something about men and women -- the way they're supposed to be. Caring for each other, being happy with each other, being good to each other. That's what we call love. You'll like that a lot. -- Kirk, "The Apple", stardate 3715.6 _______________________________________________ Tkinter-discuss mailing list Tkinter-discuss@python.org http://mail.python.org/mailman/listinfo/tkinter-discuss