pyqt | gui generated by object wont show
a quick description of my "program". When I click the menu entry in the main window, a popup window opens to get the user input, triggering a subframe to show in the main window (which was hidden until then). This subframe has a button which should create another frame (part of another class) imbedded in the subframe. The Problem is that it won't show up when I click the button. I've searched for a solution, but couldn't find one.
Thanks in advance!
import sys
from PyQt5.Qt import *
from PyQt5.uic import *
class Main_fr(QMainWindow):
def __init__(self):
super().__init__()
self.mainwin = loadUi("Main.ui", self)
self.menu_crnewwin.triggered.connect(self.inputwindow)
self.subWin = loadUi("subwin_Fr.ui", self.mainwin.mainFrame)
self.subWin.createObj.clicked.connect(self.obj_fr)
self.subWin.hide()
self.mainwin.show()
def inputwindow(self):
text, ok = QInputDialog.getText(self, "Input Window", "Some input:")
if ok:
self.subWin_fr()
def subWin_fr(self):
self.subWin.show()
def obj_fr(self):
self.w = Some_obj(self.subWin.objframe, "userentry").gui()
class Some_obj():
def __init__(self, master, userinput):
self.master = master
self.userinput = userinput
self.iterable = loadUi("subsubWin.ui", self.master)
self.iterable.hide()
def gui(self):
self.iterable.show()
def run():
app = QApplication(sys.argv)
GUI = Main_fr()
sys.exit(app.exec_())
run()
Main file:
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>df</class>
<widget class="QMainWindow" name="df">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>584</width>
<height>578</height>
</rect>
</property>
<property name="windowTitle">
<string>Fruchtfolge</string>
</property>
<widget class="QWidget" name="mainFrame"/>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>584</width>
<height>25</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
<property name="title">
<string>File</string>
</property>
<addaction name="menu_crnewwin"/>
<addaction name="open"/>
<addaction name="close"/>
<addaction name="separator"/>
<addaction name="close_prog"/>
</widget>
<addaction name="menuFile"/>
</widget>
<widget class="QStatusBar" name="statusbar"/>
<widget class="QToolBar" name="toolBar">
<property name="windowTitle">
<string>toolBar</string>
</property>
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
</widget>
<action name="menu_crnewwin">
<property name="text">
<string>New</string>
</property>
</action>
<action name="open">
<property name="text">
<string>Open</string>
</property>
</action>
<action name="close">
<property name="text">
<string>Close</string>
</property>
</action>
<action name="close_prog">
<property name="text">
<string>Close program</string>
</property>
</action>
</widget>
<resources/>
<connections/>
</ui>
subwin file:
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Form</class>
<widget class="QWidget" name="Form">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>761</width>
<height>413</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="3" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QCheckBox" name="checkBox_3">
<property name="text">
<string>option 1</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox_2">
<property name="text">
<string>option 2</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="checkBox">
<property name="text">
<string>option 3</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="0" colspan="2">
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>some text</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QPushButton" name="createObj">
<property name="text">
<string>new object</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0" colspan="2">
<widget class="QWidget" name="objframe" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_5"/>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
subsubwin file:
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Form</class>
<widget class="QWidget" name="Form">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>746</width>
<height>48</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout">
<property name="horizontalSpacing">
<number>0</number>
</property>
<item row="0" column="23">
<widget class="QWidget" name="widget_28" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string>background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="25">
<widget class="QWidget" name="widget_25" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string>background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="35">
<widget class="QWidget" name="widget_13" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="4">
<widget class="QWidget" name="widget_2" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="33">
<widget class="QWidget" name="widget_18" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="28">
<widget class="QWidget" name="widget_15" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="name">
<property name="text">
<string>Name:</string>
</property>
</widget>
</item>
<item row="0" column="36">
<widget class="QWidget" name="widget_23" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string>background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="27">
<widget class="QWidget" name="widget_26" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string>background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="21">
<widget class="QWidget" name="widget_27" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string>background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="20">
<widget class="QWidget" name="widget_10" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="8">
<widget class="QWidget" name="widget_8" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="37">
<widget class="QWidget" name="widget_17" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="14">
<widget class="QWidget" name="widget_21" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="22">
<widget class="QWidget" name="widget_11" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="13">
<widget class="QWidget" name="widget_9" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="32">
<widget class="QWidget" name="widget_20" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="31">
<widget class="QWidget" name="widget_19" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="19">
<widget class="QWidget" name="widget_24" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string>background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="9">
<widget class="QWidget" name="widget_32" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string>background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="16">
<widget class="QWidget" name="widget_30" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string>background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="24">
<widget class="QWidget" name="widget_12" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QComboBox" name="comboBox">
<property name="sizeAdjustPolicy">
<enum>QComboBox::AdjustToContentsOnFirstShow</enum>
</property>
<item>
<property name="text">
<string>some list</string>
</property>
</item>
</widget>
</item>
<item row="0" column="18">
<widget class="QWidget" name="widget_29" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string>background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="6">
<widget class="QWidget" name="widget_5" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="11">
<widget class="QWidget" name="widget_31" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string>background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="15">
<widget class="QWidget" name="widget_34" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string>background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="30">
<widget class="QWidget" name="widget_16" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="17">
<widget class="QWidget" name="widget_14" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="5">
<widget class="QWidget" name="widget_4" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="26">
<widget class="QWidget" name="widget_7" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="12">
<widget class="QWidget" name="widget_33" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string>background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="34">
<widget class="QWidget" name="widget_3" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="7">
<widget class="QWidget" name="widget_6" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QWidget" name="widget_36" native="true"/>
</item>
<item row="0" column="38">
<widget class="QWidget" name="widget" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="10">
<widget class="QWidget" name="widget_35" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string>background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="29">
<widget class="QWidget" name="widget_22" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string>background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QWidget" name="widget_37" native="true"/>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
python pyqt
add a comment |
a quick description of my "program". When I click the menu entry in the main window, a popup window opens to get the user input, triggering a subframe to show in the main window (which was hidden until then). This subframe has a button which should create another frame (part of another class) imbedded in the subframe. The Problem is that it won't show up when I click the button. I've searched for a solution, but couldn't find one.
Thanks in advance!
import sys
from PyQt5.Qt import *
from PyQt5.uic import *
class Main_fr(QMainWindow):
def __init__(self):
super().__init__()
self.mainwin = loadUi("Main.ui", self)
self.menu_crnewwin.triggered.connect(self.inputwindow)
self.subWin = loadUi("subwin_Fr.ui", self.mainwin.mainFrame)
self.subWin.createObj.clicked.connect(self.obj_fr)
self.subWin.hide()
self.mainwin.show()
def inputwindow(self):
text, ok = QInputDialog.getText(self, "Input Window", "Some input:")
if ok:
self.subWin_fr()
def subWin_fr(self):
self.subWin.show()
def obj_fr(self):
self.w = Some_obj(self.subWin.objframe, "userentry").gui()
class Some_obj():
def __init__(self, master, userinput):
self.master = master
self.userinput = userinput
self.iterable = loadUi("subsubWin.ui", self.master)
self.iterable.hide()
def gui(self):
self.iterable.show()
def run():
app = QApplication(sys.argv)
GUI = Main_fr()
sys.exit(app.exec_())
run()
Main file:
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>df</class>
<widget class="QMainWindow" name="df">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>584</width>
<height>578</height>
</rect>
</property>
<property name="windowTitle">
<string>Fruchtfolge</string>
</property>
<widget class="QWidget" name="mainFrame"/>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>584</width>
<height>25</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
<property name="title">
<string>File</string>
</property>
<addaction name="menu_crnewwin"/>
<addaction name="open"/>
<addaction name="close"/>
<addaction name="separator"/>
<addaction name="close_prog"/>
</widget>
<addaction name="menuFile"/>
</widget>
<widget class="QStatusBar" name="statusbar"/>
<widget class="QToolBar" name="toolBar">
<property name="windowTitle">
<string>toolBar</string>
</property>
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
</widget>
<action name="menu_crnewwin">
<property name="text">
<string>New</string>
</property>
</action>
<action name="open">
<property name="text">
<string>Open</string>
</property>
</action>
<action name="close">
<property name="text">
<string>Close</string>
</property>
</action>
<action name="close_prog">
<property name="text">
<string>Close program</string>
</property>
</action>
</widget>
<resources/>
<connections/>
</ui>
subwin file:
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Form</class>
<widget class="QWidget" name="Form">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>761</width>
<height>413</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="3" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QCheckBox" name="checkBox_3">
<property name="text">
<string>option 1</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox_2">
<property name="text">
<string>option 2</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="checkBox">
<property name="text">
<string>option 3</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="0" colspan="2">
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>some text</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QPushButton" name="createObj">
<property name="text">
<string>new object</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0" colspan="2">
<widget class="QWidget" name="objframe" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_5"/>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
subsubwin file:
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Form</class>
<widget class="QWidget" name="Form">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>746</width>
<height>48</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout">
<property name="horizontalSpacing">
<number>0</number>
</property>
<item row="0" column="23">
<widget class="QWidget" name="widget_28" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string>background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="25">
<widget class="QWidget" name="widget_25" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string>background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="35">
<widget class="QWidget" name="widget_13" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="4">
<widget class="QWidget" name="widget_2" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="33">
<widget class="QWidget" name="widget_18" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="28">
<widget class="QWidget" name="widget_15" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="name">
<property name="text">
<string>Name:</string>
</property>
</widget>
</item>
<item row="0" column="36">
<widget class="QWidget" name="widget_23" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string>background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="27">
<widget class="QWidget" name="widget_26" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string>background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="21">
<widget class="QWidget" name="widget_27" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string>background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="20">
<widget class="QWidget" name="widget_10" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="8">
<widget class="QWidget" name="widget_8" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="37">
<widget class="QWidget" name="widget_17" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="14">
<widget class="QWidget" name="widget_21" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="22">
<widget class="QWidget" name="widget_11" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="13">
<widget class="QWidget" name="widget_9" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="32">
<widget class="QWidget" name="widget_20" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="31">
<widget class="QWidget" name="widget_19" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="19">
<widget class="QWidget" name="widget_24" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string>background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="9">
<widget class="QWidget" name="widget_32" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string>background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="16">
<widget class="QWidget" name="widget_30" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string>background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="24">
<widget class="QWidget" name="widget_12" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QComboBox" name="comboBox">
<property name="sizeAdjustPolicy">
<enum>QComboBox::AdjustToContentsOnFirstShow</enum>
</property>
<item>
<property name="text">
<string>some list</string>
</property>
</item>
</widget>
</item>
<item row="0" column="18">
<widget class="QWidget" name="widget_29" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string>background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="6">
<widget class="QWidget" name="widget_5" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="11">
<widget class="QWidget" name="widget_31" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string>background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="15">
<widget class="QWidget" name="widget_34" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string>background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="30">
<widget class="QWidget" name="widget_16" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="17">
<widget class="QWidget" name="widget_14" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="5">
<widget class="QWidget" name="widget_4" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="26">
<widget class="QWidget" name="widget_7" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="12">
<widget class="QWidget" name="widget_33" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string>background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="34">
<widget class="QWidget" name="widget_3" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="7">
<widget class="QWidget" name="widget_6" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QWidget" name="widget_36" native="true"/>
</item>
<item row="0" column="38">
<widget class="QWidget" name="widget" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="10">
<widget class="QWidget" name="widget_35" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string>background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="29">
<widget class="QWidget" name="widget_22" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string>background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QWidget" name="widget_37" native="true"/>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
python pyqt
share the .ui...
– eyllanesc
Nov 23 '18 at 16:16
the .ui file is an XML so open it with any editor, copy it and add it to your question.
– eyllanesc
Nov 24 '18 at 9:26
ty for the hint! I've updated my post
– Sneakybeaver
Nov 26 '18 at 6:29
add a comment |
a quick description of my "program". When I click the menu entry in the main window, a popup window opens to get the user input, triggering a subframe to show in the main window (which was hidden until then). This subframe has a button which should create another frame (part of another class) imbedded in the subframe. The Problem is that it won't show up when I click the button. I've searched for a solution, but couldn't find one.
Thanks in advance!
import sys
from PyQt5.Qt import *
from PyQt5.uic import *
class Main_fr(QMainWindow):
def __init__(self):
super().__init__()
self.mainwin = loadUi("Main.ui", self)
self.menu_crnewwin.triggered.connect(self.inputwindow)
self.subWin = loadUi("subwin_Fr.ui", self.mainwin.mainFrame)
self.subWin.createObj.clicked.connect(self.obj_fr)
self.subWin.hide()
self.mainwin.show()
def inputwindow(self):
text, ok = QInputDialog.getText(self, "Input Window", "Some input:")
if ok:
self.subWin_fr()
def subWin_fr(self):
self.subWin.show()
def obj_fr(self):
self.w = Some_obj(self.subWin.objframe, "userentry").gui()
class Some_obj():
def __init__(self, master, userinput):
self.master = master
self.userinput = userinput
self.iterable = loadUi("subsubWin.ui", self.master)
self.iterable.hide()
def gui(self):
self.iterable.show()
def run():
app = QApplication(sys.argv)
GUI = Main_fr()
sys.exit(app.exec_())
run()
Main file:
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>df</class>
<widget class="QMainWindow" name="df">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>584</width>
<height>578</height>
</rect>
</property>
<property name="windowTitle">
<string>Fruchtfolge</string>
</property>
<widget class="QWidget" name="mainFrame"/>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>584</width>
<height>25</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
<property name="title">
<string>File</string>
</property>
<addaction name="menu_crnewwin"/>
<addaction name="open"/>
<addaction name="close"/>
<addaction name="separator"/>
<addaction name="close_prog"/>
</widget>
<addaction name="menuFile"/>
</widget>
<widget class="QStatusBar" name="statusbar"/>
<widget class="QToolBar" name="toolBar">
<property name="windowTitle">
<string>toolBar</string>
</property>
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
</widget>
<action name="menu_crnewwin">
<property name="text">
<string>New</string>
</property>
</action>
<action name="open">
<property name="text">
<string>Open</string>
</property>
</action>
<action name="close">
<property name="text">
<string>Close</string>
</property>
</action>
<action name="close_prog">
<property name="text">
<string>Close program</string>
</property>
</action>
</widget>
<resources/>
<connections/>
</ui>
subwin file:
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Form</class>
<widget class="QWidget" name="Form">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>761</width>
<height>413</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="3" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QCheckBox" name="checkBox_3">
<property name="text">
<string>option 1</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox_2">
<property name="text">
<string>option 2</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="checkBox">
<property name="text">
<string>option 3</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="0" colspan="2">
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>some text</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QPushButton" name="createObj">
<property name="text">
<string>new object</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0" colspan="2">
<widget class="QWidget" name="objframe" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_5"/>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
subsubwin file:
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Form</class>
<widget class="QWidget" name="Form">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>746</width>
<height>48</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout">
<property name="horizontalSpacing">
<number>0</number>
</property>
<item row="0" column="23">
<widget class="QWidget" name="widget_28" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string>background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="25">
<widget class="QWidget" name="widget_25" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string>background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="35">
<widget class="QWidget" name="widget_13" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="4">
<widget class="QWidget" name="widget_2" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="33">
<widget class="QWidget" name="widget_18" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="28">
<widget class="QWidget" name="widget_15" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="name">
<property name="text">
<string>Name:</string>
</property>
</widget>
</item>
<item row="0" column="36">
<widget class="QWidget" name="widget_23" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string>background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="27">
<widget class="QWidget" name="widget_26" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string>background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="21">
<widget class="QWidget" name="widget_27" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string>background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="20">
<widget class="QWidget" name="widget_10" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="8">
<widget class="QWidget" name="widget_8" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="37">
<widget class="QWidget" name="widget_17" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="14">
<widget class="QWidget" name="widget_21" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="22">
<widget class="QWidget" name="widget_11" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="13">
<widget class="QWidget" name="widget_9" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="32">
<widget class="QWidget" name="widget_20" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="31">
<widget class="QWidget" name="widget_19" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="19">
<widget class="QWidget" name="widget_24" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string>background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="9">
<widget class="QWidget" name="widget_32" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string>background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="16">
<widget class="QWidget" name="widget_30" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string>background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="24">
<widget class="QWidget" name="widget_12" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QComboBox" name="comboBox">
<property name="sizeAdjustPolicy">
<enum>QComboBox::AdjustToContentsOnFirstShow</enum>
</property>
<item>
<property name="text">
<string>some list</string>
</property>
</item>
</widget>
</item>
<item row="0" column="18">
<widget class="QWidget" name="widget_29" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string>background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="6">
<widget class="QWidget" name="widget_5" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="11">
<widget class="QWidget" name="widget_31" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string>background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="15">
<widget class="QWidget" name="widget_34" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string>background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="30">
<widget class="QWidget" name="widget_16" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="17">
<widget class="QWidget" name="widget_14" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="5">
<widget class="QWidget" name="widget_4" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="26">
<widget class="QWidget" name="widget_7" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="12">
<widget class="QWidget" name="widget_33" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string>background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="34">
<widget class="QWidget" name="widget_3" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="7">
<widget class="QWidget" name="widget_6" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QWidget" name="widget_36" native="true"/>
</item>
<item row="0" column="38">
<widget class="QWidget" name="widget" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="10">
<widget class="QWidget" name="widget_35" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string>background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="29">
<widget class="QWidget" name="widget_22" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string>background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QWidget" name="widget_37" native="true"/>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
python pyqt
a quick description of my "program". When I click the menu entry in the main window, a popup window opens to get the user input, triggering a subframe to show in the main window (which was hidden until then). This subframe has a button which should create another frame (part of another class) imbedded in the subframe. The Problem is that it won't show up when I click the button. I've searched for a solution, but couldn't find one.
Thanks in advance!
import sys
from PyQt5.Qt import *
from PyQt5.uic import *
class Main_fr(QMainWindow):
def __init__(self):
super().__init__()
self.mainwin = loadUi("Main.ui", self)
self.menu_crnewwin.triggered.connect(self.inputwindow)
self.subWin = loadUi("subwin_Fr.ui", self.mainwin.mainFrame)
self.subWin.createObj.clicked.connect(self.obj_fr)
self.subWin.hide()
self.mainwin.show()
def inputwindow(self):
text, ok = QInputDialog.getText(self, "Input Window", "Some input:")
if ok:
self.subWin_fr()
def subWin_fr(self):
self.subWin.show()
def obj_fr(self):
self.w = Some_obj(self.subWin.objframe, "userentry").gui()
class Some_obj():
def __init__(self, master, userinput):
self.master = master
self.userinput = userinput
self.iterable = loadUi("subsubWin.ui", self.master)
self.iterable.hide()
def gui(self):
self.iterable.show()
def run():
app = QApplication(sys.argv)
GUI = Main_fr()
sys.exit(app.exec_())
run()
Main file:
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>df</class>
<widget class="QMainWindow" name="df">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>584</width>
<height>578</height>
</rect>
</property>
<property name="windowTitle">
<string>Fruchtfolge</string>
</property>
<widget class="QWidget" name="mainFrame"/>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>584</width>
<height>25</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
<property name="title">
<string>File</string>
</property>
<addaction name="menu_crnewwin"/>
<addaction name="open"/>
<addaction name="close"/>
<addaction name="separator"/>
<addaction name="close_prog"/>
</widget>
<addaction name="menuFile"/>
</widget>
<widget class="QStatusBar" name="statusbar"/>
<widget class="QToolBar" name="toolBar">
<property name="windowTitle">
<string>toolBar</string>
</property>
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
</widget>
<action name="menu_crnewwin">
<property name="text">
<string>New</string>
</property>
</action>
<action name="open">
<property name="text">
<string>Open</string>
</property>
</action>
<action name="close">
<property name="text">
<string>Close</string>
</property>
</action>
<action name="close_prog">
<property name="text">
<string>Close program</string>
</property>
</action>
</widget>
<resources/>
<connections/>
</ui>
subwin file:
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Form</class>
<widget class="QWidget" name="Form">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>761</width>
<height>413</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="3" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QCheckBox" name="checkBox_3">
<property name="text">
<string>option 1</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox_2">
<property name="text">
<string>option 2</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="checkBox">
<property name="text">
<string>option 3</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="0" colspan="2">
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>some text</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QPushButton" name="createObj">
<property name="text">
<string>new object</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0" colspan="2">
<widget class="QWidget" name="objframe" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_5"/>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
subsubwin file:
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Form</class>
<widget class="QWidget" name="Form">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>746</width>
<height>48</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout">
<property name="horizontalSpacing">
<number>0</number>
</property>
<item row="0" column="23">
<widget class="QWidget" name="widget_28" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string>background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="25">
<widget class="QWidget" name="widget_25" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string>background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="35">
<widget class="QWidget" name="widget_13" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="4">
<widget class="QWidget" name="widget_2" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="33">
<widget class="QWidget" name="widget_18" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="28">
<widget class="QWidget" name="widget_15" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="name">
<property name="text">
<string>Name:</string>
</property>
</widget>
</item>
<item row="0" column="36">
<widget class="QWidget" name="widget_23" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string>background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="27">
<widget class="QWidget" name="widget_26" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string>background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="21">
<widget class="QWidget" name="widget_27" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string>background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="20">
<widget class="QWidget" name="widget_10" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="8">
<widget class="QWidget" name="widget_8" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="37">
<widget class="QWidget" name="widget_17" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="14">
<widget class="QWidget" name="widget_21" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="22">
<widget class="QWidget" name="widget_11" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="13">
<widget class="QWidget" name="widget_9" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="32">
<widget class="QWidget" name="widget_20" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="31">
<widget class="QWidget" name="widget_19" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="19">
<widget class="QWidget" name="widget_24" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string>background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="9">
<widget class="QWidget" name="widget_32" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string>background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="16">
<widget class="QWidget" name="widget_30" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string>background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="24">
<widget class="QWidget" name="widget_12" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QComboBox" name="comboBox">
<property name="sizeAdjustPolicy">
<enum>QComboBox::AdjustToContentsOnFirstShow</enum>
</property>
<item>
<property name="text">
<string>some list</string>
</property>
</item>
</widget>
</item>
<item row="0" column="18">
<widget class="QWidget" name="widget_29" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string>background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="6">
<widget class="QWidget" name="widget_5" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="11">
<widget class="QWidget" name="widget_31" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string>background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="15">
<widget class="QWidget" name="widget_34" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string>background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="30">
<widget class="QWidget" name="widget_16" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="17">
<widget class="QWidget" name="widget_14" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="5">
<widget class="QWidget" name="widget_4" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="26">
<widget class="QWidget" name="widget_7" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="12">
<widget class="QWidget" name="widget_33" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string>background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="34">
<widget class="QWidget" name="widget_3" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="7">
<widget class="QWidget" name="widget_6" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QWidget" name="widget_36" native="true"/>
</item>
<item row="0" column="38">
<widget class="QWidget" name="widget" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="10">
<widget class="QWidget" name="widget_35" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string>background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="29">
<widget class="QWidget" name="widget_22" native="true">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string>background-color: rgb(204, 0, 0);</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QWidget" name="widget_37" native="true"/>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
python pyqt
python pyqt
edited Nov 26 '18 at 6:28
Sneakybeaver
asked Nov 23 '18 at 8:21
SneakybeaverSneakybeaver
12
12
share the .ui...
– eyllanesc
Nov 23 '18 at 16:16
the .ui file is an XML so open it with any editor, copy it and add it to your question.
– eyllanesc
Nov 24 '18 at 9:26
ty for the hint! I've updated my post
– Sneakybeaver
Nov 26 '18 at 6:29
add a comment |
share the .ui...
– eyllanesc
Nov 23 '18 at 16:16
the .ui file is an XML so open it with any editor, copy it and add it to your question.
– eyllanesc
Nov 24 '18 at 9:26
ty for the hint! I've updated my post
– Sneakybeaver
Nov 26 '18 at 6:29
share the .ui...
– eyllanesc
Nov 23 '18 at 16:16
share the .ui...
– eyllanesc
Nov 23 '18 at 16:16
the .ui file is an XML so open it with any editor, copy it and add it to your question.
– eyllanesc
Nov 24 '18 at 9:26
the .ui file is an XML so open it with any editor, copy it and add it to your question.
– eyllanesc
Nov 24 '18 at 9:26
ty for the hint! I've updated my post
– Sneakybeaver
Nov 26 '18 at 6:29
ty for the hint! I've updated my post
– Sneakybeaver
Nov 26 '18 at 6:29
add a comment |
1 Answer
1
active
oldest
votes
According to your code you are trying to replace one widget with another and that is not possible since changing the reference does not change the object, the solution in this case is to place the new widget inside objframe using the layout that you have set in Qt Designer:
class Main_fr(QMainWindow):
# ...
def obj_fr(self):
self.w = Some_obj(self.subWin.objframe, "userentry")
self.w.gui()
class Some_obj():
def __init__(self, master, userinput):
self.master = master
self.userinput = userinput
self.iterable = loadUi("subsubWin.ui")
self.master.layout().addWidget(self.iterable)
def gui(self):
self.iterable.show()

Oh I see, that makes sense now. My thought was, that it would just insert it into the master widget. Thank you for your help and patience!
– Sneakybeaver
Nov 26 '18 at 10:53
@Sneakybeaver If my answer helps you do not forget to mark it as correct, if you do not know how to do it then review the tour, that's the best way to thank :-)
– eyllanesc
Nov 26 '18 at 10:56
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53442936%2fpyqt-gui-generated-by-object-wont-show%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
According to your code you are trying to replace one widget with another and that is not possible since changing the reference does not change the object, the solution in this case is to place the new widget inside objframe using the layout that you have set in Qt Designer:
class Main_fr(QMainWindow):
# ...
def obj_fr(self):
self.w = Some_obj(self.subWin.objframe, "userentry")
self.w.gui()
class Some_obj():
def __init__(self, master, userinput):
self.master = master
self.userinput = userinput
self.iterable = loadUi("subsubWin.ui")
self.master.layout().addWidget(self.iterable)
def gui(self):
self.iterable.show()

Oh I see, that makes sense now. My thought was, that it would just insert it into the master widget. Thank you for your help and patience!
– Sneakybeaver
Nov 26 '18 at 10:53
@Sneakybeaver If my answer helps you do not forget to mark it as correct, if you do not know how to do it then review the tour, that's the best way to thank :-)
– eyllanesc
Nov 26 '18 at 10:56
add a comment |
According to your code you are trying to replace one widget with another and that is not possible since changing the reference does not change the object, the solution in this case is to place the new widget inside objframe using the layout that you have set in Qt Designer:
class Main_fr(QMainWindow):
# ...
def obj_fr(self):
self.w = Some_obj(self.subWin.objframe, "userentry")
self.w.gui()
class Some_obj():
def __init__(self, master, userinput):
self.master = master
self.userinput = userinput
self.iterable = loadUi("subsubWin.ui")
self.master.layout().addWidget(self.iterable)
def gui(self):
self.iterable.show()

Oh I see, that makes sense now. My thought was, that it would just insert it into the master widget. Thank you for your help and patience!
– Sneakybeaver
Nov 26 '18 at 10:53
@Sneakybeaver If my answer helps you do not forget to mark it as correct, if you do not know how to do it then review the tour, that's the best way to thank :-)
– eyllanesc
Nov 26 '18 at 10:56
add a comment |
According to your code you are trying to replace one widget with another and that is not possible since changing the reference does not change the object, the solution in this case is to place the new widget inside objframe using the layout that you have set in Qt Designer:
class Main_fr(QMainWindow):
# ...
def obj_fr(self):
self.w = Some_obj(self.subWin.objframe, "userentry")
self.w.gui()
class Some_obj():
def __init__(self, master, userinput):
self.master = master
self.userinput = userinput
self.iterable = loadUi("subsubWin.ui")
self.master.layout().addWidget(self.iterable)
def gui(self):
self.iterable.show()

According to your code you are trying to replace one widget with another and that is not possible since changing the reference does not change the object, the solution in this case is to place the new widget inside objframe using the layout that you have set in Qt Designer:
class Main_fr(QMainWindow):
# ...
def obj_fr(self):
self.w = Some_obj(self.subWin.objframe, "userentry")
self.w.gui()
class Some_obj():
def __init__(self, master, userinput):
self.master = master
self.userinput = userinput
self.iterable = loadUi("subsubWin.ui")
self.master.layout().addWidget(self.iterable)
def gui(self):
self.iterable.show()

answered Nov 26 '18 at 6:48
eyllanesceyllanesc
85k103563
85k103563
Oh I see, that makes sense now. My thought was, that it would just insert it into the master widget. Thank you for your help and patience!
– Sneakybeaver
Nov 26 '18 at 10:53
@Sneakybeaver If my answer helps you do not forget to mark it as correct, if you do not know how to do it then review the tour, that's the best way to thank :-)
– eyllanesc
Nov 26 '18 at 10:56
add a comment |
Oh I see, that makes sense now. My thought was, that it would just insert it into the master widget. Thank you for your help and patience!
– Sneakybeaver
Nov 26 '18 at 10:53
@Sneakybeaver If my answer helps you do not forget to mark it as correct, if you do not know how to do it then review the tour, that's the best way to thank :-)
– eyllanesc
Nov 26 '18 at 10:56
Oh I see, that makes sense now. My thought was, that it would just insert it into the master widget. Thank you for your help and patience!
– Sneakybeaver
Nov 26 '18 at 10:53
Oh I see, that makes sense now. My thought was, that it would just insert it into the master widget. Thank you for your help and patience!
– Sneakybeaver
Nov 26 '18 at 10:53
@Sneakybeaver If my answer helps you do not forget to mark it as correct, if you do not know how to do it then review the tour, that's the best way to thank :-)
– eyllanesc
Nov 26 '18 at 10:56
@Sneakybeaver If my answer helps you do not forget to mark it as correct, if you do not know how to do it then review the tour, that's the best way to thank :-)
– eyllanesc
Nov 26 '18 at 10:56
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53442936%2fpyqt-gui-generated-by-object-wont-show%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
share the .ui...
– eyllanesc
Nov 23 '18 at 16:16
the .ui file is an XML so open it with any editor, copy it and add it to your question.
– eyllanesc
Nov 24 '18 at 9:26
ty for the hint! I've updated my post
– Sneakybeaver
Nov 26 '18 at 6:29