Skip to content
Pak Cyberbot edited this page Feb 27, 2024 · 3 revisions

GUI Template: BaseCSITabs & CSIMainWindow

Use BaseCSITabs to create a tab widget that holds multiple widgets or windows within it. You can then provide it to the CSIMainWindow object.

Example code demonstrating the usage of these two classes:

from csilibs.gui import BaseCSITabs, CSIMainWindow
# Some more libraries

class ExampleAppWindow(QMainWindow):
    # app code    
class Example2(QMainWindow):
    # app code

if __name__ == "__main__":
    app = QApplication(sys.argv)
    
    # Create the main window
    main_window = CSIMainWindow()
    
    # you can also use QWidgets too
    window1 = ExampleAppWindow()
    window2 = Example2()
    
    # You can set location of tabs, Default is top/up/north 
    tabs = BaseCSITabs({"Example App 1": window1, "App 2": window2}, "left")
    
    main_window.setCentralWidget(tabs)
    
    # You can set size of window too, Default 70% width & 90% height
    main_window.set_application(app, 50,50)
    
    qdarktheme.setup_theme()
    
    # Show the main window
    main_window.show()
    
    # Start the applicaStion event loop
    sys.exit(app.exec_())
GUI_template_example.mp4
Clone this wiki locally