""" Shows a simple progress bar. """ from pylibui.core import App from pylibui.controls import Window, ProgressBar class MyWindow(Window): def onClose(self, data): super().onClose(data) app.stop() app = App() window = MyWindow('Progress bar example') window.setMargined(True) progressbar = ProgressBar() progressbar.setValue(60) window.setChild(progressbar) window.show() app.start() app.close()
from pylibui.controls import (Window, Entry, SearchEntry, PasswordEntry, VerticalBox) class MyWindow(Window): def onClose(self, data): super().onClose(data) app.stop() class MyEntry(Entry): def onChanged(self, data): print('entry changed!') app = App() window = MyWindow('Entry example') window.setMargined(True) entry = MyEntry() search_entry = SearchEntry() password_entry = PasswordEntry() vbox = VerticalBox() vbox.setPadded(True) vbox.append(entry) vbox.append(search_entry) vbox.append(password_entry) window.setChild(vbox)
import logging from pylibui.core import App from pylibui.controls import * app = App() widget_manager = None def get_widget_manager(): global widget_manager if not widget_manager: widget_manager = WidgetManager() return widget_manager def create_widget(name): return get_widget_manager().create_widget(name) def run_app(): app.start() app.close() def stop_app(): app.stop()
""" Shows a window with a vertical box and some labels. """ from pylibui.core import App from pylibui.controls import Window, Label, VerticalBox class MyWindow(Window): def onClose(self, data): super().onClose(data) app.stop() with App(): window = MyWindow('Window', 800, 600) window.setMargined(1) vbox = VerticalBox() vbox.setPadded(1) window.setChild(vbox) vbox.append(Label('Hello World!')) vbox.append(Label('Goodbye World!')) window.show()
def setUp(self): self.app = App() self.window = Window('Window', 800, 600)