Thread: User-Interface
View Single Post
  #28  
Old 02-15-2005, 12:27 PM
Johannes Johannes is offline
Member
 
Join Date: Jan 2005
Posts: 143
OK. Looking at it I was thinking if it does not take too much 'ressources' running in complex applications?!


New question: I'm having trouble with the checkbox-feature. This does not seem to work?!

Help says:
<node2d:button>.get
This action will return the current state of the Button or Checkbox



<node2d:button>.get(

)

Remarks

This action will return whether the Button or Checkbox is down or up.



Return Value

viz.DOWN or viz.UP



Example

button = viz.add(viz.BUTTON)
.
.
.
if button.get() == viz.DOWN:
print ‘The button is currently down’
else:
print ‘The button is currently up’
-----------------------------------------------------------------


this neither:



Code:
balltraceCheckbox = viz.add(viz.CHECKBOX,viz.SCREEN)
print 'balltraceCheckboxState',balltraceCheckbox.get()
if (balltraceCheckbox.get() == viz.DOWN):
	print 'halloIsNotDownasdfasf'
balltraceCheckbox.translate(0.3,0.3)
showBalltraceCheckbox=0




def mybutton(obj,pos):
	print 'halloMyButton',obj,pos
	print balltraceCheckbox.get()
	global ballMaterialDensity,showBalltraceCheckbox
	if obj == radioPine:
		ballMaterialDensity=350
	if obj == radioPlastic:
		ballMaterialDensity=700
	if obj == radioSilver:
		ballMaterialDensity=10490
	if obj == radioIron:
		ballMaterialDensity=2100
	if obj == radioGranite:
		ballMaterialDensity=2691
	if obj == radioGold:
		ballMaterialDensity=19320
	if obj == balltraceCheckbox:
		#showBalltraceCheckbox=pos
		print 'shoabadf:',showBalltraceCheckbox

viz.callback(viz.BUTTON_EVENT,mybutton)
Reply With Quote