{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "%matplotlib inline" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# GUI icons from resources\n\nDemostration to show a ui file, that contains icons from a qrc / rcc\nresource file.\n\nTo create the ui file, you need at first the icons and the index\nfile qrc, that lists all the icons and gives them a unique path.\n\nThis qrc file then must be compiled together with the contained\nicons to a rcc resource file using the rcc binary (shipped with itom).\n\nFor instance, to compile the qrc file in the icons subfolder to\na rcc file in this folder, navigate a command line to the icons\nsubfolder and apply\n\n..code-block:: bat\n\n rcc -binary myIconResource.qrc -o ../myIconResource.rcc\n\nThen, the resource file must be loaded first into itom before opening\nthe ui.\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "import itom\nfrom itom import ui\n\n\n\n# load the resource file, such that the contained icons can be used in future UIs\nitom.registerResource(\"myIconResource.rcc\")\n\n# load the UI (open the UI in QtDesigner to see how the icons are assigned there)\ngui = ui(\"gui_with_icons_from_resource.ui\", type=ui.TYPEWINDOW)\n\n# show the UI (no functionality at all)\ngui.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n\n" ] } ], "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 }