Bitmap button without any border, and changing the picture while pressed?
So, this seems like it should be the default to me... if you're going to make your own picture for a button, I don't see why you'd want the default border around it, but I can't for the life of me figure out how to get rid of it.
I also need to change the picture of the button while it's pressed (and change back once it's released) so you can tell that you're actually pressing it.
I actually did figure this out yesterday (It literally took all day though.), but deleted the code because I decided not to use that button, and now I can't figure it out again. (Gotta remember to save these things. =/)
Can I add one more question to this? (It doesn't let me edit the first post anymore, sorry.)
Before, when I had the borderless bitmap button, if it overlapped something else, it would cause part of the other object to become invisible, where the border would have been. Is there a way to stop that from happening? Basically, the border is still there, it's just invisible, and when it overlaps things, it obstructs them.
# show a Tkinter button without border
# see also Button at:
# http://infohost.nmt.edu/tcc/help/pubs/tkinter/tkinter.pdf
try:
# Python2
import Tkinter as tk
except ImportError:
# Python3
import tkinter as tk
root = tk.Tk()
root.title("A button without border")
# pick a GIF image you have in the working directory
# or give full path
image = tk.PhotoImage(file='Farm.gif')
# create a button to display the image
# use bd or borderwidth zero for no border
button = tk.Button(root, image=image, bd=0)
# position the widgets
button.grid(row=1, column=1)
root.mainloop()