View Single Post
  #3  
Old 07-13-2009, 10:00 AM
lilio lilio is offline
Member
 
Join Date: May 2009
Posts: 11
Hi,

thanks for your answer. But this does not work.

For example:

I've got this class:

Code:
import viz

class Button(object):
	
	def createButton(self, position, name):
		name = viz.add(viz.BUTTON)
		name.translate(position[0], position[1])
		return name

and this start.py

Code:
import viz
import button

viz.go()


button = button.Button()

button.createButton([0.2,0.5], 'testbutton')

def onButton(obj,state):
	if obj == button.testbutton:
		print 'test'

viz.callback(viz.BUTTON_EVENT,onButton)
So I want to create a button with the name testbutton. And afterthat I want to check if the testbutton is clicked.

In my example, the button got the name 'testbutton'.

But then, I've got the error message: 'Button' object has no attribute 'testbutton'


What is wrong??

Reply With Quote