Scrap/Random Hacks/radio button.txt
Richard Wright 5f35433c9b Scrap codes
2015-03-01 17:03:11 +00:00

4 lines
No EOL
953 B
Text

import direct.directbase.DirectStartfrom direct.gui.OnscreenText import OnscreenText from direct.gui.DirectGui import *from pandac.PandaModules import * v = [0]# Add some textbk_text = "This is my Demo"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) # Callback function to set text def setText(status=None): bk_text = "CurrentValue : %s"%v textObject.setText(bk_text) # Add buttonbuttons = [ DirectRadioButton(text = 'RadioButton0', variable=v, value=[0], scale=0.05, pos=(-0.4,0,0), command=setText), DirectRadioButton(text = 'RadioButton1', variable=v, value=[1], scale=0.05, pos=(0,0,0), command=setText), DirectRadioButton(text = 'RadioButton2', variable=v, value=[2], scale=0.05, pos=(0.4,0,0), command=setText)]
closet = base.cr.doFindAll("closet")[0]
closet.sendUpdate("setDNA", ['t\x00\x08\x01\x00\x50\x1b\x45\x1b\x26\x1b\x0e\x04\x0e\x0e', 34, 34])