Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Label(window, "A tool palette", "sans-bold")
tools = Widget(window)
tools.setLayout(BoxLayout(Orientation.Horizontal,
Alignment.Middle, 0, 6))
ToolButton(tools, entypo.ICON_CLOUD)
ToolButton(tools, entypo.ICON_CONTROLLER_FAST_FORWARD)
ToolButton(tools, entypo.ICON_COMPASS)
ToolButton(tools, entypo.ICON_INSTALL)
Label(window, "Popup buttons", "sans-bold")
popupBtn = PopupButton(window, "Popup", entypo.ICON_EXPORT)
popup = popupBtn.popup()
popup.setLayout(GroupLayout())
Label(popup, "Arbitrary widgets can be placed here")
CheckBox(popup, "A check box")
# popup right
popupBtn = PopupButton(popup, "Recursive popup", entypo.ICON_FLASH)
popupRight = popupBtn.popup()
popupRight.setLayout(GroupLayout())
CheckBox(popupRight, "Another check box")
# popup left
popupBtn = PopupButton(popup, "Recursive popup", entypo.ICON_FLASH)
popupBtn.setSide(Popup.Side.Left)
popupLeft = popupBtn.popup()
popupLeft.setLayout(GroupLayout())
CheckBox(popupLeft, "Another check box");
window = Window(self, "Basic widgets")
window.setPosition((200, 15))
window.setLayout(GroupLayout())
popupBtn = PopupButton(window, "Popup", entypo.ICON_EXPORT)
popup = popupBtn.popup()
popup.setLayout(GroupLayout())
Label(popup, "Arbitrary widgets can be placed here")
CheckBox(popup, "A check box")
# popup right
popupBtn = PopupButton(popup, "Recursive popup", entypo.ICON_FLASH)
popupRight = popupBtn.popup()
popupRight.setLayout(GroupLayout())
CheckBox(popupRight, "Another check box")
# popup left
popupBtn = PopupButton(popup, "Recursive popup", entypo.ICON_FLASH)
popupBtn.setSide(Popup.Side.Left)
popupLeft = popupBtn.popup()
popupLeft.setLayout(GroupLayout())
CheckBox(popupLeft, "Another check box");
window = Window(self, "Basic widgets")
window.setPosition((200, 15))
window.setLayout(GroupLayout())
Label(window, "Message dialog", "sans-bold")
tools = Widget(window)
tools.setLayout(BoxLayout(Orientation.Horizontal,
Alignment.Middle, 0, 6))
def cb2(result):
print("Dialog result: %i" % result)
b = Button(tools, "Info")
def cb():
popupBtn = PopupButton(window, "Popup", entypo.ICON_EXPORT)
popup = popupBtn.popup()
popup.setLayout(GroupLayout())
Label(popup, "Arbitrary widgets can be placed here")
CheckBox(popup, "A check box")
# popup right
popupBtn = PopupButton(popup, "Recursive popup", entypo.ICON_FLASH)
popupRight = popupBtn.popup()
popupRight.setLayout(GroupLayout())
CheckBox(popupRight, "Another check box")
# popup left
popupBtn = PopupButton(popup, "Recursive popup", entypo.ICON_FLASH)
popupBtn.setSide(Popup.Side.Left)
popupLeft = popupBtn.popup()
popupLeft.setLayout(GroupLayout())
CheckBox(popupLeft, "Another check box");
window = Window(self, "Basic widgets")
window.setPosition((200, 15))
window.setLayout(GroupLayout())
Label(window, "Message dialog", "sans-bold")
tools = Widget(window)
tools.setLayout(BoxLayout(Orientation.Horizontal,
Alignment.Middle, 0, 6))
def cb2(result):
print("Dialog result: %i" % result)
b = Button(tools, "Info")
def cb():
ToolButton(tools, entypo.ICON_CLOUD)
ToolButton(tools, entypo.ICON_CONTROLLER_FAST_FORWARD)
ToolButton(tools, entypo.ICON_COMPASS)
ToolButton(tools, entypo.ICON_INSTALL)
Label(window, "Popup buttons", "sans-bold")
popupBtn = PopupButton(window, "Popup", entypo.ICON_EXPORT)
popup = popupBtn.popup()
popup.setLayout(GroupLayout())
Label(popup, "Arbitrary widgets can be placed here")
CheckBox(popup, "A check box")
# popup right
popupBtn = PopupButton(popup, "Recursive popup", entypo.ICON_FLASH)
popupRight = popupBtn.popup()
popupRight.setLayout(GroupLayout())
CheckBox(popupRight, "Another check box")
# popup left
popupBtn = PopupButton(popup, "Recursive popup", entypo.ICON_FLASH)
popupBtn.setSide(Popup.Side.Left)
popupLeft = popupBtn.popup()
popupLeft.setLayout(GroupLayout())
CheckBox(popupLeft, "Another check box");
window = Window(self, "Basic widgets")
window.setPosition((200, 15))
window.setLayout(GroupLayout())
Label(window, "Message dialog", "sans-bold")
tools = Widget(window)
tools.setLayout(BoxLayout(Orientation.Horizontal,
Alignment.Middle, 0, 6))
b.setCallback(cb)
Label(window, "Combo box", "sans-bold")
ComboBox(window, ["Combo box item 1", "Combo box item 2",
"Combo box item 3"])
Label(window, "Check box", "sans-bold")
def cb(state):
print("Check box 1 state: %s" % state)
chb = CheckBox(window, "Flag 1", cb)
chb.setChecked(True)
def cb(state):
print("Check box 2 state: %s" % state)
CheckBox(window, "Flag 2", cb)
Label(window, "Progress bar", "sans-bold")
self.progress = ProgressBar(window)
Label(window, "Slider and text box", "sans-bold")
panel = Widget(window)
panel.setLayout(BoxLayout(Orientation.Horizontal,
Alignment.Middle, 0, 20))
slider = Slider(panel)
slider.setValue(0.5)
slider.setFixedWidth(80)
textBox = TextBox(panel)
textBox.setFixedSize((60, 25))
b = Button(tools, "Save")
def cb():
result = nanogui.file_dialog(valid, True)
print("File dialog result = %s" % result)
b.setCallback(cb)
Label(window, "Combo box", "sans-bold")
ComboBox(window, ["Combo box item 1", "Combo box item 2",
"Combo box item 3"])
Label(window, "Check box", "sans-bold")
def cb(state):
print("Check box 1 state: %s" % state)
chb = CheckBox(window, "Flag 1", cb)
chb.setChecked(True)
def cb(state):
print("Check box 2 state: %s" % state)
CheckBox(window, "Flag 2", cb)
Label(window, "Progress bar", "sans-bold")
self.progress = ProgressBar(window)
Label(window, "Slider and text box", "sans-bold")
panel = Widget(window)
panel.setLayout(BoxLayout(Orientation.Horizontal,
Alignment.Middle, 0, 20))
slider = Slider(panel)
Label(window, "A tool palette", "sans-bold")
tools = Widget(window)
tools.setLayout(BoxLayout(Orientation.Horizontal,
Alignment.Middle, 0, 6))
ToolButton(tools, entypo.ICON_CLOUD)
ToolButton(tools, entypo.ICON_CONTROLLER_FAST_FORWARD)
ToolButton(tools, entypo.ICON_COMPASS)
ToolButton(tools, entypo.ICON_INSTALL)
Label(window, "Popup buttons", "sans-bold")
popupBtn = PopupButton(window, "Popup", entypo.ICON_EXPORT)
popup = popupBtn.popup()
popup.setLayout(GroupLayout())
Label(popup, "Arbitrary widgets can be placed here")
CheckBox(popup, "A check box")
# popup right
popupBtn = PopupButton(popup, "Recursive popup", entypo.ICON_FLASH)
popupRight = popupBtn.popup()
popupRight.setLayout(GroupLayout())
CheckBox(popupRight, "Another check box")
# popup left
popupBtn = PopupButton(popup, "Recursive popup", entypo.ICON_FLASH)
popupBtn.setSide(Popup.Side.Left)
popupLeft = popupBtn.popup()
popupLeft.setLayout(GroupLayout())
CheckBox(popupLeft, "Another check box");
window = Window(self, "Basic widgets")
window.setPosition((200, 15))
window.setLayout(GroupLayout())
ToolButton(tools, entypo.ICON_CLOUD)
ToolButton(tools, entypo.ICON_CONTROLLER_FAST_FORWARD)
ToolButton(tools, entypo.ICON_COMPASS)
ToolButton(tools, entypo.ICON_INSTALL)
Label(window, "Popup buttons", "sans-bold")
popupBtn = PopupButton(window, "Popup", entypo.ICON_EXPORT)
popup = popupBtn.popup()
popup.setLayout(GroupLayout())
Label(popup, "Arbitrary widgets can be placed here")
CheckBox(popup, "A check box")
# popup right
popupBtn = PopupButton(popup, "Recursive popup", entypo.ICON_FLASH)
popupRight = popupBtn.popup()
popupRight.setLayout(GroupLayout())
CheckBox(popupRight, "Another check box")
# popup left
popupBtn = PopupButton(popup, "Recursive popup", entypo.ICON_FLASH)
popupBtn.setSide(Popup.Side.Left)
popupLeft = popupBtn.popup()
popupLeft.setLayout(GroupLayout())
CheckBox(popupLeft, "Another check box");
window = Window(self, "Basic widgets")
window.setPosition((200, 15))
window.setLayout(GroupLayout())
Label(window, "Message dialog", "sans-bold")
tools = Widget(window)
tools.setLayout(BoxLayout(Orientation.Horizontal,
Alignment.Middle, 0, 6))
Label(window, "Positive integer :", "sans-bold")
intBox = IntBox(window)
intBox.setEditable(True)
intBox.setFixedSize((100, 20))
intBox.setValue(50)
intBox.setUnits("Mhz")
intBox.setDefaultValue("0")
intBox.setFontSize(16)
intBox.setFormat("[1-9][0-9]*")
intBox.setSpinnable(True)
intBox.setMinValue(1)
intBox.setValueIncrement(2)
Label(window, "Checkbox :", "sans-bold")
cb = CheckBox(window, "Check me")
cb.setFontSize(16)
cb.setChecked(True)
Label(window, "Combo box :", "sans-bold")
cobo = ComboBox(window, ["Item 1", "Item 2", "Item 3"])
cobo.setFontSize(16)
cobo.setFixedSize((100, 20))
Label(window, "Color picker :", "sans-bold");
cp = ColorPicker(window, Color(255, 120, 0, 255));
cp.setFixedSize((100, 20));
def cp_final_cb(color):
print(
"ColorPicker Final Callback: [{0}, {1}, {2}, {3}]".format(color.r,
color.g,
Label(window, "Positive integer :", "sans-bold")
intBox = IntBox(window)
intBox.setEditable(True)
intBox.setFixedSize((100, 20))
intBox.setValue(50)
intBox.setUnits("Mhz")
intBox.setDefaultValue("0")
intBox.setFontSize(16)
intBox.setFormat("[1-9][0-9]*")
intBox.setSpinnable(True)
intBox.setMinValue(1)
intBox.setValueIncrement(2)
Label(window, "Checkbox :", "sans-bold")
cb = CheckBox(window, "Check me")
cb.setFontSize(16)
cb.setChecked(True)
Label(window, "Combo box :", "sans-bold")
cobo = ComboBox(window, ["Item 1", "Item 2", "Item 3"])
cobo.setFontSize(16)
cobo.setFixedSize((100, 20))
Label(window, "Color picker :", "sans-bold");
cp = ColorPicker(window, Color(255, 120, 0, 255));
cp.setFixedSize((100, 20));
def cp_final_cb(color):
print(
"ColorPicker Final Callback: [{0}, {1}, {2}, {3}]".format(color.r,
color.g,