My Code Snippet. This takes the text from the array links and creates a DirectButton object for each “Link” in the array. These buttons appear on the right side of the screen in a vertical arrangement.
links = ["LINK 1","LINK 2","LINK 3","LINK 4"] #The text to be placed into the buttons
z = 0
for i in range(len(links)):
linkButton = DirectButton(text = (links[i]), scale=.09, relief=None, text_fg = (0.30,0.35,0.35,1), text_font = loader.loadFont('fonts/Impact.ttf'))
linkButton.setPos(1.35, 0, z)
linkButton.bind(DGG.WITHIN, linkButton.configure(text_fg = (1,1,1,1)))
z = z - 0.15
This piece of code i am working on is intended to display buttons on a menu page. I want to be able to change the font color for each link when the mouse hovers over the link, but it seems im not understanding how the bind class works. This example prints an Assertion error. Can anyone give me any suggestions on how i can get the mouseOver event to change the font color?
EDIT: I am using version 1.9.0 on Ubuntu Utopic