All I want the Button to do when it’s clicked is to change the text color to white and make the alpha of the text to half. But it’s not working!
oh and also can anyone help me with changing my button’s pos to the top right corner? if you can that would be great!!!
import direct.directbase.DirectStart
from direct.gui.OnscreenText import OnscreenText
from direct.gui.DirectGui import *
from pandac.PandaModules import TextNode
bk_text = "experimenting with Direct GUIs"
textObject = OnscreenText(text = bk_text, pos = (0.95,-0.95),
scale = 0.07,fg=(1,0.5,0.5,1),align=TextNode.ACenter,mayChange=1)
def setText():
bk_text = "Button Clicked"
textObject.setText(bk_text)
maps = loader.loadModel('button_maps.egg')
b = DirectButton(relief = None, text_pos= ( .9, -0.015),text_fg= (0,0,0,1),
text = ("Campaign", "Campaign", "Campaign", "Campaign"),scale=0.8,command=(setText,text_fg= (1,1,1,1)),text_scale= (.15,.08),
geom_pos = ( .9,-5,0),
geom = (maps.find('**/button_up'),
maps.find('**/button_down'),
maps.find('**/button_up'),
maps.find('**/button_dis')))
run()