{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "%matplotlib inline" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Window\n\nWindow is a stand-alone window. The window is only hidden\nif the user closes it. Call show again to re-show it. It is only\ndeleted, if the window variable is deleted.\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "from itom import ui\n\n\n\nwindow = ui(\"mainWindow.ui\", ui.TYPEWINDOW)\nwindow.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Window_destroy is a stand-alone window,\nthat is deleted if the user closes it, not only hidden\"\"\"\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "def window_destroyed():\n print(\"window_destroy destroyed\")\n\n\nwindow_destroy = ui(\"mainWindow.ui\", ui.TYPEWINDOW, deleteOnClose=True)\n# deleteOnClose can also be set or unset using setAttribute\nprint(\"state of deleteOnClose flag:\", window_destroy.getAttribute(55))\nwindow_destroy.setAttribute(55, True)\n\nwindow_destroy[\n \"windowTitle\"\n] = \"Self-destroyable main window\" # change title of main window\nwindow_destroy.connect(\"destroyed()\", window_destroyed)\nwindow_destroy.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Window_no_child is a stand-alone window that is no child of the main window with own symbol in the task bar\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "window_no_child = ui(\"mainWindow.ui\", ui.TYPEWINDOW, childOfMainWindow=False)\nwindow_no_child[\n \"windowTitle\"\n] = \"Stand-alone main window\" # change title of main window\nwindow_no_child.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Widget_window is a stand-alone window obtained from a widget that was created in QtDesigner.\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "widget_window = ui(\"widget.ui\", ui.TYPEWINDOW)\nwidget_window.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Configure a window to not have a maximize button and to always stay on top.\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "window_on_top = ui(\"mainWindow.ui\", ui.TYPEWINDOW)\nwindow_on_top[\"windowTitle\"] = \"On-top window\" # change title of main window\n# 0x00040000 is the flag Qt::WindowStaysOnTopHint and needs to be added if not yet done (or)\n# 0x00008000 is the flag Qt::WindowMaximizeButtonHint and needs to be removed if not yet done (xor)\nwindow_on_top.setWindowFlags(\n (window_on_top.getWindowFlags() | 0x00040000) ^ 0x00008000\n)\n\n# it is also possible to disable the close button by xor-ing Qt::WindowCloseButtonHint (0x08000000)\n\nwindow_on_top.show()" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.10" } }, "nbformat": 4, "nbformat_minor": 0 }