def __init__(self): DirectButton.__init__(self, parent=aspect2d, frameColor=(1, 1, 1, 0), relief=DGG.FLAT, commandButtons=[]) self.accept('window-event', self.windowResize) self.windowResize(None) #trick: make this re-throw mouse events self.bind(self.B1PRESS, self.rethrowEvent, ['mouse1']) self.bind(self.B2PRESS, self.rethrowEvent, ['mouse2']) self.bind(self.B3PRESS, self.rethrowEvent, ['mouse3']) self.bind(self.B4PRESS, self.rethrowEvent, ['mouse4']) self.bind(self.B5PRESS, self.rethrowEvent, ['mouse5']) self.bind(self.WHEELUP, self.rethrowEvent, ['wheel_up']) self.bind(self.WHEELDOWN, self.rethrowEvent, ['wheel_down']) self.bind(self.WHEELLEFT, self.rethrowEvent, ['wheel_left']) self.bind(self.WHEELRIGHT, self.rethrowEvent, ['wheel_right']) self.bind(self.B1RELEASE, self.rethrowEvent, ['mouse1-up']) self.bind(self.B2RELEASE, self.rethrowEvent, ['mouse2-up']) self.bind(self.B3RELEASE, self.rethrowEvent, ['mouse3-up']) self.bind(self.B4RELEASE, self.rethrowEvent, ['mouse4-up']) self.bind(self.B5RELEASE, self.rethrowEvent, ['mouse5-up'])
def __init__(self, text, pos, parent=None, **kwargs): kwargs['text'] = text kwargs['pressEffect'] = 1 # Button appears to press when clicked kwargs['pos'] = pos kwargs['scale'] = .1 kwargs['pad'] = (.5, .5) DirectButton.__init__(self, parent, **kwargs) self.initialiseoptions(BBButton) # needed for subclassing DirectGui
def __init__(self, *args, **kwargs): DirectButton.__init__(self, *args, **kwargs) self['frameSize'] = (-1, 1, -1, 1) self['relief'] = FLAT shader = Shader.load(Shader.SL_GLSL, 'yyagl/assets/shaders/filter.vert', 'yyagl/assets/shaders/imgbtn.frag') self.setShader(shader) self.setShaderInput('col_offset', 0) self.setShaderInput('enable', 1) self.setTransparency(True) self.bind(ENTER, self._on_enter) self.bind(EXIT, self._on_exit) self.initialiseoptions(self.__class__)
def __init__(self): DirectButton.__init__(self,parent = aspect2d, frameColor =(1,1,1,0), relief = DGG.FLAT,commandButtons = []) self.accept('window-event', self.windowResize) self.windowResize(None) #trick: make this re-throw mouse events self.bind(self.B1PRESS, self.rethrowEvent,['mouse1']) self.bind(self.B2PRESS, self.rethrowEvent,['mouse2']) self.bind(self.B3PRESS, self.rethrowEvent,['mouse3']) self.bind(self.B4PRESS, self.rethrowEvent,['mouse4']) self.bind(self.B5PRESS, self.rethrowEvent,['mouse5']) self.bind(self.WHEELUP, self.rethrowEvent, ['wheel_up']) self.bind(self.WHEELDOWN, self.rethrowEvent, ['wheel_down']) self.bind(self.WHEELLEFT, self.rethrowEvent, ['wheel_left']) self.bind(self.WHEELRIGHT, self.rethrowEvent, ['wheel_right']) self.bind(self.B1RELEASE, self.rethrowEvent,['mouse1-up']) self.bind(self.B2RELEASE, self.rethrowEvent,['mouse2-up']) self.bind(self.B3RELEASE, self.rethrowEvent,['mouse3-up']) self.bind(self.B4RELEASE, self.rethrowEvent,['mouse4-up']) self.bind(self.B5RELEASE, self.rethrowEvent,['mouse5-up'])
def __init__(self, parent=None, **kw): optiondefs = ( # Define type of DirectGuiWidget ('pgFunc', PGButton, None), ('numStates', 4, None), ('state', DGG.NORMAL, None), ('relief', None, None), ('invertedFrames', (1, ), None), ('frameSize', (-1, 1, -1, 1), None), ('scale', 0.05, None), # Command to be called on button click ('command', None, None), ('extraArgs', [], None), # Which mouse buttons can be used to click the button ('commandButtons', (DGG.LMB, ), self.setCommandButtons), # Sounds to be used for button events ('rolloverSound', DGG.getDefaultRolloverSound(), self.setRolloverSound), ('clickSound', DGG.getDefaultClickSound(), self.setClickSound), # Can only be specified at time of widget contruction # Do the text/graphics appear to move when the button is clicked ('pressEffect', 1, DGG.INITOPT), ('uncheckedImage', 'ui/default/checkbox_unchecked.png', self.setUncheckedImage), ('checkedImage', 'ui/default/checkbox_checked.png', self.setCheckedImage), ('uncheckedGeom', None, None), ('checkedGeom', None, None), ('isChecked', False, self.renewgeom), ) # Merge keyword options with default options self.defineoptions(kw, optiondefs) DirectButton.__init__(self, parent) self.__checkstatedumpnp = NodePath('checkstatenp') self.initialiseoptions(SDirectCheckBox)
def __init__(self, parent = None, **kw): optiondefs = ( # Define type of DirectGuiWidget ('pgFunc', PGButton, None), ('numStates', 4, None), ('state', DGG.NORMAL, None), ('relief', None, None), ('invertedFrames', (1,), None), ('frameSize', (-1,1,-1,1),None), ('scale', 0.05, None), # Command to be called on button click ('command', None, None), ('extraArgs', [], None), # Which mouse buttons can be used to click the button ('commandButtons', (DGG.LMB,), self.setCommandButtons), # Sounds to be used for button events ('rolloverSound', DGG.getDefaultRolloverSound(), self.setRolloverSound), ('clickSound', DGG.getDefaultClickSound(), self.setClickSound), # Can only be specified at time of widget contruction # Do the text/graphics appear to move when the button is clicked ('pressEffect', 1, DGG.INITOPT), ('uncheckedImage', 'ui/default/checkbox_unchecked.png', self.setUncheckedImage), ('checkedImage', 'ui/default/checkbox_checked.png', self.setCheckedImage), ('uncheckedGeom', None, None), ('checkedGeom', None, None), ('isChecked', False, self.renewgeom), ) # Merge keyword options with default options self.defineoptions(kw, optiondefs) DirectButton.__init__(self,parent) self.__checkstatedumpnp = NodePath('checkstatenp') self.initialiseoptions(SDirectCheckBox)