Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def keyboardEvent(self, key, scancode, action, modifiers):
if super(TestApp, self).keyboardEvent(key, scancode,
action, modifiers):
return True
if key == glfw.KEY_ESCAPE and action == glfw.PRESS:
self.setVisible(False)
return True
return False
if __name__ == "__main__":
nanogui.init()
test = TestApp()
test.drawAll()
test.setVisible(True)
nanogui.mainloop()
del test
gc.collect()
nanogui.shutdown()
def keyboardEvent(self, key, scancode, action, modifiers):
if super(TestApp, self).keyboardEvent(key, scancode,
action, modifiers):
return True
if key == glfw.KEY_ESCAPE and action == glfw.PRESS:
self.setVisible(False)
return True
return False
if __name__ == "__main__":
nanogui.init()
test = TestApp()
test.drawAll()
test.setVisible(True)
nanogui.mainloop()
del test
gc.collect()
nanogui.shutdown()
def cb2():
self.setVisible(False)
b.setCallback(cb2)
self.performLayout()
if __name__ == "__main__":
nanogui.init()
test = TestApp()
test.drawAll()
test.setVisible(True)
print("Launching detached mainloop")
h = nanogui.mainloop(detach=test)
print("Back in Python context")
for i in range(10):
print(i)
time.sleep(1)
if not nanogui.active():
break
h.join()
nanogui.shutdown()
def keyboardEvent(self, key, scancode, action, modifiers):
if super(TestApp, self).keyboardEvent(key, scancode,
action, modifiers):
return True
if key == glfw.KEY_ESCAPE and action == glfw.PRESS:
self.setVisible(False)
return True
return False
if __name__ == "__main__":
nanogui.init()
test = TestApp()
test.drawAll()
test.setVisible(True)
nanogui.mainloop()
del test
gc.collect()
nanogui.shutdown()
gui.addColorVariable("Color", *make_accessors("colvar")).setFinalCallback(cp_final_cb)
gui.addGroup("Other widgets")
def cb():
print("Button pressed.")
gui.addButton("A button", cb)
screen.setVisible(True)
screen.performLayout()
window.center()
nanogui.mainloop()
screen = gui = window = None
gc.collect()
nanogui.shutdown()