Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Sorry I'm new to Python, and have cobbled together an app with QT Designer and copying samples from the Internet - so pardon the lack of style!

ISSUE: When I click in any checkbox, the state never changes. Always 0 / False.

MAIN:
Python
<pre>
import configparser
import datetime
import os
import pathlib
import platform
import sys
#import builder_gui
from builder_gui import Ui_MainWindow
# from functools import partial
from pathlib import Path
from PyQt5 import QtWidgets
from PyQt5.QtCore import QTime

defaultSlides = {}
churchesFile = 'churches.ini'
codeVersion = '0.07A'

# Separating church config processing
embeddedFolders = ['040','070','080','090','120','150','160','170','190','210','220','250']
launchPath = ''
slideFolders = ['010','020','030','040','050','060','070','080','090',\
                '100','110','115','120','130','140','150','160','170',\
                '180','190','200','210','220','230','240','250','260']

# Define a class to setup the UI
class BuilderApp(QtWidgets.QWidget, Ui_MainWindow):
    def __init__(self,  parent=None):
        super().__init__(parent)
#        Ui_MainWindow.__init__(self)
        # Load the main form
#        self.lblCode.setText(codeVersion)
        print("?")
        self.setupUi(self)
        self.chk040.toggled.connect(lambda: self.embedToggled("040"))
        self.chk070.stateChanged.connect(lambda: self.embedToggled("070"))
        self.chk080.toggled.connect(lambda: self.embedToggled("080"))
        self.chk090.toggled.connect(lambda: self.embedToggled("090"))
        self.chk120.toggled.connect(lambda: self.embedToggled("120"))
        self.chk150.toggled.connect(lambda: self.embedToggled("150"))
        self.chk160.toggled.connect(lambda: self.embedToggled("160"))
        self.chk170.toggled.connect(lambda: self.embedToggled("170"))
        self.chk190.toggled.connect(lambda: self.embedToggled("190"))
        self.chk210.toggled.connect(lambda: self.embedToggled("210"))
        self.chk220.toggled.connect(lambda: self.embedToggled("220"))
        self.chk250.toggled.connect(lambda: self.embedToggled("250"))

        
    # Declare method to react to Embedded Music checkboxes
    def embedToggled(self, index):
        # Reprocess the affected combobox
#         prepCombo(index, Path(parentDir + '/' + eval('ui.cbx' + index + '.text()')), )
        print(index)
        print('isChecked: ', eval('ui.chk' + index + '.isChecked()'))
        print('checkState: ', eval('ui.chk' + index + '.checkState()'))
#        ui.prepCombo(index)

    

if __name__ == "__main__":
    app = QtWidgets.QApplication(sys.argv)
    MainWindow = QtWidgets.QWidget()
    ui = BuilderApp()
    # main()
    ui.setupUi(MainWindow)
    ui.show()
    
    sys.exit(app.exec_())



GUI:

Python
<pre>
# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file 'P:\StFrancis\PowerPoint\000 Start\builder_gui_v0.02A.ui'
#
# Created by: PyQt5 UI code generator 5.15.4
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again.  Do not edit this file unless you know what you are doing.


from PyQt5 import QtCore, QtGui, QtWidgets


class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.setWindowModality(QtCore.Qt.NonModal)
        MainWindow.resize(730, 870)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(MainWindow.sizePolicy().hasHeightForWidth())
        MainWindow.setSizePolicy(sizePolicy)
        MainWindow.setMinimumSize(QtCore.QSize(730, 870))
        MainWindow.setMaximumSize(QtCore.QSize(730, 870))
        self.lblTitle = QtWidgets.QLabel(MainWindow)
        self.lblTitle.setGeometry(QtCore.QRect(30, 10, 671, 91))
        font = QtGui.QFont()
        font.setPointSize(48)
        self.lblTitle.setFont(font)
        self.lblTitle.setObjectName("lblTitle")
        self.cbxChurch = QtWidgets.QComboBox(MainWindow)
        self.cbxChurch.setGeometry(QtCore.QRect(250, 150, 101, 21))
        font = QtGui.QFont()
        font.setPointSize(10)
        self.cbxChurch.setFont(font)
        self.cbxChurch.setObjectName("cbxChurch")
        self.cbxChurch.addItem("")
        self.cbxChurch.addItem("")
        self.datMass = QtWidgets.QDateEdit(MainWindow)
        self.datMass.setGeometry(QtCore.QRect(360, 150, 111, 21))
        font = QtGui.QFont()
        font.setPointSize(10)
        self.datMass.setFont(font)
        self.datMass.setObjectName("datMass")
        self.timMass = QtWidgets.QTimeEdit(MainWindow)
        self.timMass.setGeometry(QtCore.QRect(480, 150, 71, 21))
        font = QtGui.QFont()
        font.setPointSize(10)
        self.timMass.setFont(font)
        self.timMass.setObjectName("timMass")
        self.lblMass = QtWidgets.QLabel(MainWindow)
        self.lblMass.setGeometry(QtCore.QRect(30, 150, 201, 21))
        font = QtGui.QFont()
        font.setPointSize(14)
        self.lblMass.setFont(font)
        self.lblMass.setObjectName("lblMass")
        self.lblParts = QtWidgets.QLabel(MainWindow)
        self.lblParts.setGeometry(QtCore.QRect(30, 190, 201, 31))
        font = QtGui.QFont()
        font.setPointSize(14)
        self.lblParts.setFont(font)
        self.lblParts.setObjectName("lblParts")
        self.lbl010 = QtWidgets.QLabel(MainWindow)
        self.lbl010.setGeometry(QtCore.QRect(30, 220, 201, 21))
        font = QtGui.QFont()
        font.setPointSize(10)
        self.lbl010.setFont(font)
        self.lbl010.setObjectName("lbl010")
        self.cbx010 = QtWidgets.QComboBox(MainWindow)
        self.cbx010.setGeometry(QtCore.QRect(250, 220, 451, 22))
        self.cbx010.setObjectName("cbx010")
        self.lbl020 = QtWidgets.QLabel(MainWindow)
        self.lbl020.setGeometry(QtCore.QRect(30, 240, 201, 21))
        font = QtGui.QFont()
        font.setPointSize(10)
        self.lbl020.setFont(font)
        self.lbl020.setObjectName("lbl020")
        self.cbx020 = QtWidgets.QComboBox(MainWindow)
        self.cbx020.setGeometry(QtCore.QRect(250, 240, 451, 22))
        self.cbx020.setCurrentText("")
        self.cbx020.setObjectName("cbx020")
        self.lbl030 = QtWidgets.QLabel(MainWindow)
        self.lbl030.setGeometry(QtCore.QRect(30, 260, 201, 21))
        font = QtGui.QFont()
        font.setPointSize(10)
        self.lbl030.setFont(font)
        self.lbl030.setObjectName("lbl030")
        self.cbx030 = QtWidgets.QComboBox(MainWindow)
        self.cbx030.setGeometry(QtCore.QRect(250, 260, 451, 22))
        self.cbx030.setObjectName("cbx030")
        self.lbl040 = QtWidgets.QLabel(MainWindow)
        self.lbl040.setGeometry(QtCore.QRect(30, 280, 201, 21))
        font = QtGui.QFont()
        font.setPointSize(10)
        self.lbl040.setFont(font)
        self.lbl040.setObjectName("lbl040")
        self.cbx040 = QtWidgets.QComboBox(MainWindow)
        self.cbx040.setGeometry(QtCore.QRect(250, 280, 451, 22))
        self.cbx040.setObjectName("cbx040")
        self.lbl050 = QtWidgets.QLabel(MainWindow)
        self.lbl050.setGeometry(QtCore.QRect(30, 300, 201, 21))
        font = QtGui.QFont()
        font.setPointSize(10)
        self.lbl050.setFont(font)
        self.lbl050.setObjectName("lbl050")
        self.cbx050 = QtWidgets.QComboBox(MainWindow)
        self.cbx050.setGeometry(QtCore.QRect(250, 300, 451, 22))
        self.cbx050.setObjectName("cbx050")
        self.lbl060 = QtWidgets.QLabel(MainWindow)
        self.lbl060.setGeometry(QtCore.QRect(30, 320, 201, 21))
        font = QtGui.QFont()
        font.setPointSize(10)
        self.lbl060.setFont(font)
        self.lbl060.setObjectName("lbl060")
        self.cbx060 = QtWidgets.QComboBox(MainWindow)
        self.cbx060.setGeometry(QtCore.QRect(250, 320, 451, 22))
        self.cbx060.setObjectName("cbx060")
        self.lbl070 = QtWidgets.QLabel(MainWindow)
        self.lbl070.setGeometry(QtCore.QRect(30, 340, 201, 21))
        font = QtGui.QFont()
        font.setPointSize(10)
        self.lbl070.setFont(font)
        self.lbl070.setObjectName("lbl070")
        self.cbx070 = QtWidgets.QComboBox(MainWindow)
        self.cbx070.setGeometry(QtCore.QRect(250, 340, 451, 22))
        self.cbx070.setObjectName("cbx070")
        self.lbl080 = QtWidgets.QLabel(MainWindow)
        self.lbl080.setGeometry(QtCore.QRect(30, 360, 201, 21))
        font = QtGui.QFont()
        font.setPointSize(10)
        self.lbl080.setFont(font)
        self.lbl080.setObjectName("lbl080")
        self.cbx080 = QtWidgets.QComboBox(MainWindow)
        self.cbx080.setGeometry(QtCore.QRect(250, 360, 451, 22))
        self.cbx080.setObjectName("cbx080")
        self.lbl090 = QtWidgets.QLabel(MainWindow)
        self.lbl090.setGeometry(QtCore.QRect(30, 380, 201, 21))
        font = QtGui.QFont()
        font.setPointSize(10)
        self.lbl090.setFont(font)
        self.lbl090.setObjectName("lbl090")
        self.cbx090 = QtWidgets.QComboBox(MainWindow)
        self.cbx090.setGeometry(QtCore.QRect(250, 380, 451, 22))
        self.cbx090.setObjectName("cbx090")
        self.lbl100 = QtWidgets.QLabel(MainWindow)
        self.lbl100.setGeometry(QtCore.QRect(30, 400, 201, 21))
        font = QtGui.QFont()
        font.setPointSize(10)
        self.lbl100.setFont(font)
        self.lbl100.setObjectName("lbl100")
        self.cbx100 = QtWidgets.QComboBox(MainWindow)
        self.cbx100.setGeometry(QtCore.QRect(250, 400, 451, 22))
        self.cbx100.setObjectName("cbx100")
        self.cbx110 = QtWidgets.QComboBox(MainWindow)
        self.cbx110.setGeometry(QtCore.QRect(250, 420, 451, 22))
        self.cbx110.setObjectName("cbx110")
        self.lbl110 = QtWidgets.QLabel(MainWindow)
        self.lbl110.setGeometry(QtCore.QRect(30, 420, 201, 21))
        font = QtGui.QFont()
        font.setPointSize(10)
        self.lbl110.setFont(font)
        self.lbl110.setObjectName("lbl110")
        self.lbl115 = QtWidgets.QLabel(MainWindow)
        self.lbl115.setGeometry(QtCore.QRect(30, 440, 201, 21))
        font = QtGui.QFont()
        font.setPointSize(10)
        self.lbl115.setFont(font)
        self.lbl115.setObjectName("lbl115")
        self.cbx115 = QtWidgets.QComboBox(MainWindow)
        self.cbx115.setGeometry(QtCore.QRect(250, 440, 451, 22))
        self.cbx115.setObjectName("cbx115")
        self.lbl120 = QtWidgets.QLabel(MainWindow)
        self.lbl120.setGeometry(QtCore.QRect(30, 460, 201, 21))
        font = QtGui.QFont()
        font.setPointSize(10)
        self.lbl120.setFont(font)
        self.lbl120.setObjectName("lbl120")
        self.cbx120 = QtWidgets.QComboBox(MainWindow)
        self.cbx120.setGeometry(QtCore.QRect(250, 460, 451, 22))
        self.cbx120.setObjectName("cbx120")
        self.lbl130 = QtWidgets.QLabel(MainWindow)
        self.lbl130.setGeometry(QtCore.QRect(30, 480, 201, 21))
        font = QtGui.QFont()
        font.setPointSize(10)
        self.lbl130.setFont(font)
        self.lbl130.setObjectName("lbl130")
        self.cbx130 = QtWidgets.QComboBox(MainWindow)
        self.cbx130.setGeometry(QtCore.QRect(250, 480, 451, 22))
        self.cbx130.setObjectName("cbx130")
        self.lbl140 = QtWidgets.QLabel(MainWindow)
        self.lbl140.setGeometry(QtCore.QRect(30, 500, 201, 21))
        font = QtGui.QFont()
        font.setPointSize(10)
        self.lbl140.setFont(font)
        self.lbl140.setObjectName("lbl140")
        self.cbx140 = QtWidgets.QComboBox(MainWindow)
        self.cbx140.setGeometry(QtCore.QRect(250, 500, 451, 22))
        self.cbx140.setObjectName("cbx140")
        self.cbx150 = QtWidgets.QComboBox(MainWindow)
        self.cbx150.setGeometry(QtCore.QRect(250, 520, 451, 22))
        self.cbx150.setObjectName("cbx150")
        self.lbl150 = QtWidgets.QLabel(MainWindow)
        self.lbl150.setGeometry(QtCore.QRect(30, 520, 201, 21))
        font = QtGui.QFont()
        font.setPointSize(10)
        self.lbl150.setFont(font)
        self.lbl150.setObjectName("lbl150")
        self.cbx160 = QtWidgets.QComboBox(MainWindow)
        self.cbx160.setGeometry(QtCore.QRect(250, 540, 451, 22))
        self.cbx160.setObjectName("cbx160")
        self.lbl160 = QtWidgets.QLabel(MainWindow)
        self.lbl160.setGeometry(QtCore.QRect(30, 540, 201, 21))
        font = QtGui.QFont()
        font.setPointSize(10)
        self.lbl160.setFont(font)
        self.lbl160.setObjectName("lbl160")
        self.cbx170 = QtWidgets.QComboBox(MainWindow)
        self.cbx170.setGeometry(QtCore.QRect(250, 560, 451, 22))
        self.cbx170.setObjectName("cbx170")
        self.lbl170 = QtWidgets.QLabel(MainWindow)
        self.lbl170.setGeometry(QtCore.QRect(30, 560, 201, 21))
        font = QtGui.QFont()
        font.setPointSize(10)
        self.lbl170.setFont(font)
        self.lbl170.setObjectName("lbl170")
        self.cbx180 = QtWidgets.QComboBox(MainWindow)
        self.cbx180.setGeometry(QtCore.QRect(250, 580, 451, 22))
        self.cbx180.setObjectName("cbx180")
        self.lbl180 = QtWidgets.QLabel(MainWindow)
        self.lbl180.setGeometry(QtCore.QRect(30, 580, 201, 21))
        font = QtGui.QFont()
        font.setPointSize(10)
        self.lbl180.setFont(font)
        self.lbl180.setObjectName("lbl180")
        self.lbl190 = QtWidgets.QLabel(MainWindow)
        self.lbl190.setGeometry(QtCore.QRect(30, 600, 201, 21))
        font = QtGui.QFont()
        font.setPointSize(10)
        self.lbl190.setFont(font)
        self.lbl190.setObjectName("lbl190")
        self.cbx190 = QtWidgets.QComboBox(MainWindow)
        self.cbx190.setGeometry(QtCore.QRect(250, 600, 451, 22))
        self.cbx190.setObjectName("cbx190")
        self.lbl200 = QtWidgets.QLabel(MainWindow)
        self.lbl200.setGeometry(QtCore.QRect(30, 620, 201, 21))
        font = QtGui.QFont()
        font.setPointSize(10)
        self.lbl200.setFont(font)
        self.lbl200.setObjectName("lbl200")
        self.cbx200 = QtWidgets.QComboBox(MainWindow)
        self.cbx200.setGeometry(QtCore.QRect(250, 620, 451, 22))
        self.cbx200.setObjectName("cbx200")
        self.lbl210 = QtWidgets.QLabel(MainWindow)
        self.lbl210.setGeometry(QtCore.QRect(30, 640, 201, 21))
        font = QtGui.QFont()
        font.setPointSize(10)
        self.lbl210.setFont(font)
        self.lbl210.setObjectName("lbl210")
        self.cbx210 = QtWidgets.QComboBox(MainWindow)
        self.cbx210.setGeometry(QtCore.QRect(250, 640, 451, 22))
        self.cbx210.setObjectName("cbx210")
        self.lbl220 = QtWidgets.QLabel(MainWindow)
        self.lbl220.setGeometry(QtCore.QRect(30, 660, 201, 21))
        font = QtGui.QFont()
        font.setPointSize(10)
        self.lbl220.setFont(font)
        self.lbl220.setObjectName("lbl220")
        self.cbx220 = QtWidgets.QComboBox(MainWindow)
        self.cbx220.setGeometry(QtCore.QRect(250, 660, 451, 22))
        self.cbx220.setObjectName("cbx220")
        self.lbl230 = QtWidgets.QLabel(MainWindow)
        self.lbl230.setGeometry(QtCore.QRect(30, 680, 201, 21))
        font = QtGui.QFont()
        font.setPointSize(10)
        self.lbl230.setFont(font)
        self.lbl230.setObjectName("lbl230")
        self.cbx230 = QtWidgets.QComboBox(MainWindow)
        self.cbx230.setGeometry(QtCore.QRect(250, 680, 451, 22))
        self.cbx230.setObjectName("cbx230")
        self.lbl240 = QtWidgets.QLabel(MainWindow)
        self.lbl240.setGeometry(QtCore.QRect(30, 700, 201, 21))
        font = QtGui.QFont()
        font.setPointSize(10)
        self.lbl240.setFont(font)
        self.lbl240.setObjectName("lbl240")
        self.cbx240 = QtWidgets.QComboBox(MainWindow)
        self.cbx240.setGeometry(QtCore.QRect(250, 700, 451, 22))
        self.cbx240.setObjectName("cbx240")
        self.lbl250 = QtWidgets.QLabel(MainWindow)
        self.lbl250.setGeometry(QtCore.QRect(30, 720, 201, 21))
        font = QtGui.QFont()
        font.setPointSize(10)
        self.lbl250.setFont(font)
        self.lbl250.setObjectName("lbl250")
        self.cbx250 = QtWidgets.QComboBox(MainWindow)
        self.cbx250.setGeometry(QtCore.QRect(250, 720, 451, 22))
        self.cbx250.setObjectName("cbx250")
        self.lbl260 = QtWidgets.QLabel(MainWindow)
        self.lbl260.setGeometry(QtCore.QRect(30, 740, 201, 21))
        font = QtGui.QFont()
        font.setPointSize(10)
        self.lbl260.setFont(font)
        self.lbl260.setObjectName("lbl260")
        self.cbx260 = QtWidgets.QComboBox(MainWindow)
        self.cbx260.setGeometry(QtCore.QRect(250, 740, 451, 22))
        self.cbx260.setObjectName("cbx260")
        self.lblPath = QtWidgets.QLabel(MainWindow)
        self.lblPath.setGeometry(QtCore.QRect(30, 90, 781, 21))
        font = QtGui.QFont()
        font.setPointSize(10)
        self.lblPath.setFont(font)
        self.lblPath.setObjectName("lblPath")
        self.lblTrust = QtWidgets.QLabel(MainWindow)
        self.lblTrust.setGeometry(QtCore.QRect(30, 100, 671, 31))
        font = QtGui.QFont()
        font.setPointSize(10)
        self.lblTrust.setFont(font)
        self.lblTrust.setObjectName("lblTrust")
        self.pbnParts = QtWidgets.QPushButton(MainWindow)
        self.pbnParts.setGeometry(QtCore.QRect(30, 800, 111, 31))
        font = QtGui.QFont()
        font.setPointSize(10)
        self.pbnParts.setFont(font)
        self.pbnParts.setObjectName("pbnParts")
        self.pbnCopyright = QtWidgets.QPushButton(MainWindow)
        self.pbnCopyright.setGeometry(QtCore.QRect(160, 800, 141, 31))
        font = QtGui.QFont()
        font.setPointSize(10)
        self.pbnCopyright.setFont(font)
        self.pbnCopyright.setObjectName("pbnCopyright")
        self.pbnAbout = QtWidgets.QPushButton(MainWindow)
        self.pbnAbout.setGeometry(QtCore.QRect(450, 800, 71, 31))
        font = QtGui.QFont()
        font.setPointSize(10)
        self.pbnAbout.setFont(font)
        self.pbnAbout.setObjectName("pbnAbout")
        self.pbnReset = QtWidgets.QPushButton(MainWindow)
        self.pbnReset.setGeometry(QtCore.QRect(540, 800, 71, 31))
        font = QtGui.QFont()
        font.setPointSize(10)
        self.pbnReset.setFont(font)
        self.pbnReset.setObjectName("pbnReset")
        self.pbnCancel = QtWidgets.QPushButton(MainWindow)
        self.pbnCancel.setGeometry(QtCore.QRect(630, 800, 71, 31))
        font = QtGui.QFont()
        font.setPointSize(10)
        self.pbnCancel.setFont(font)
        self.pbnCancel.setObjectName("pbnCancel")
        self.chk040 = QtWidgets.QCheckBox(MainWindow)
        self.chk040.setGeometry(QtCore.QRect(230, 280, 20, 21))
        self.chk040.setText("")
        self.chk040.setObjectName("chk040")
        self.lblTick = QtWidgets.QLabel(MainWindow)
        self.lblTick.setGeometry(QtCore.QRect(230, 190, 231, 31))
        font = QtGui.QFont()
        font.setPointSize(10)
        self.lblTick.setFont(font)
        self.lblTick.setObjectName("lblTick")
        self.chk070 = QtWidgets.QCheckBox(MainWindow)
        self.chk070.setGeometry(QtCore.QRect(230, 340, 20, 21))
        self.chk070.setText("")
        self.chk070.setObjectName("chk070")
        self.chk080 = QtWidgets.QCheckBox(MainWindow)
        self.chk080.setGeometry(QtCore.QRect(230, 360, 20, 21))
        self.chk080.setText("")
        self.chk080.setObjectName("chk080")
        self.chk090 = QtWidgets.QCheckBox(MainWindow)
        self.chk090.setGeometry(QtCore.QRect(230, 380, 20, 21))
        self.chk090.setText("")
        self.chk090.setObjectName("chk090")
        self.chk120 = QtWidgets.QCheckBox(MainWindow)
        self.chk120.setGeometry(QtCore.QRect(230, 460, 20, 21))
        self.chk120.setText("")
        self.chk120.setObjectName("chk120")
        self.chk150 = QtWidgets.QCheckBox(MainWindow)
        self.chk150.setGeometry(QtCore.QRect(230, 520, 20, 21))
        self.chk150.setText("")
        self.chk150.setObjectName("chk150")
        self.chk160 = QtWidgets.QCheckBox(MainWindow)
        self.chk160.setGeometry(QtCore.QRect(230, 540, 20, 21))
        self.chk160.setText("")
        self.chk160.setObjectName("chk160")
        self.chk170 = QtWidgets.QCheckBox(MainWindow)
        self.chk170.setGeometry(QtCore.QRect(230, 560, 20, 21))
        self.chk170.setText("")
        self.chk170.setObjectName("chk170")
        self.chk190 = QtWidgets.QCheckBox(MainWindow)
        self.chk190.setGeometry(QtCore.QRect(230, 600, 20, 21))
        self.chk190.setText("")
        self.chk190.setObjectName("chk190")
        self.chk210 = QtWidgets.QCheckBox(MainWindow)
        self.chk210.setGeometry(QtCore.QRect(230, 640, 20, 21))
        self.chk210.setText("")
        self.chk210.setObjectName("chk210")
        self.chk220 = QtWidgets.QCheckBox(MainWindow)
        self.chk220.setGeometry(QtCore.QRect(230, 660, 20, 21))
        self.chk220.setText("")
        self.chk220.setObjectName("chk220")
        self.chk250 = QtWidgets.QCheckBox(MainWindow)
        self.chk250.setGeometry(QtCore.QRect(230, 720, 20, 21))
        self.chk250.setText("")
        self.chk250.setObjectName("chk250")
        self.layoutWidget = QtWidgets.QWidget(MainWindow)
        self.layoutWidget.setGeometry(QtCore.QRect(30, 850, 115, 15))
        self.layoutWidget.setObjectName("layoutWidget")
        self.layGui = QtWidgets.QHBoxLayout(self.layoutWidget)
        self.layGui.setContentsMargins(0, 0, 0, 0)
        self.layGui.setObjectName("layGui")
        self.lblGui = QtWidgets.QLabel(self.layoutWidget)
        self.lblGui.setObjectName("lblGui")
        self.layGui.addWidget(self.lblGui)
        self.lblGuiVer = QtWidgets.QLabel(self.layoutWidget)
        self.lblGuiVer.setObjectName("lblGuiVer")
        self.layGui.addWidget(self.lblGuiVer)
        self.layoutWidget1 = QtWidgets.QWidget(MainWindow)
        self.layoutWidget1.setGeometry(QtCore.QRect(160, 850, 104, 15))
        self.layoutWidget1.setObjectName("layoutWidget1")
        self.layCode = QtWidgets.QHBoxLayout(self.layoutWidget1)
        self.layCode.setContentsMargins(0, 0, 0, 0)
        self.layCode.setObjectName("layCode")
        self.lblCodeVer = QtWidgets.QLabel(self.layoutWidget1)
        self.lblCodeVer.setObjectName("lblCodeVer")
        self.layCode.addWidget(self.lblCodeVer)
        self.lblCode = QtWidgets.QLabel(self.layoutWidget1)
        self.lblCode.setText("")
        self.lblCode.setObjectName("lblCode")
        self.layCode.addWidget(self.lblCode)
        self.lbl24hour = QtWidgets.QLabel(MainWindow)
        self.lbl24hour.setGeometry(QtCore.QRect(486, 170, 51, 21))
        self.lbl24hour.setObjectName("lbl24hour")

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
        MainWindow.setTabOrder(self.cbxChurch, self.datMass)
        MainWindow.setTabOrder(self.datMass, self.timMass)
        MainWindow.setTabOrder(self.timMass, self.cbx010)
        MainWindow.setTabOrder(self.cbx010, self.cbx020)
        MainWindow.setTabOrder(self.cbx020, self.cbx030)
        MainWindow.setTabOrder(self.cbx030, self.chk040)
        MainWindow.setTabOrder(self.chk040, self.cbx040)
        MainWindow.setTabOrder(self.cbx040, self.cbx060)
        MainWindow.setTabOrder(self.cbx060, self.cbx050)
        MainWindow.setTabOrder(self.cbx050, self.chk070)
        MainWindow.setTabOrder(self.chk070, self.cbx070)
        MainWindow.setTabOrder(self.cbx070, self.chk080)
        MainWindow.setTabOrder(self.chk080, self.cbx080)
        MainWindow.setTabOrder(self.cbx080, self.chk090)
        MainWindow.setTabOrder(self.chk090, self.cbx090)
        MainWindow.setTabOrder(self.cbx090, self.cbx100)
        MainWindow.setTabOrder(self.cbx100, self.cbx110)
        MainWindow.setTabOrder(self.cbx110, self.cbx115)
        MainWindow.setTabOrder(self.cbx115, self.chk120)
        MainWindow.setTabOrder(self.chk120, self.cbx120)
        MainWindow.setTabOrder(self.cbx120, self.cbx130)
        MainWindow.setTabOrder(self.cbx130, self.cbx140)
        MainWindow.setTabOrder(self.cbx140, self.chk150)
        MainWindow.setTabOrder(self.chk150, self.cbx150)
        MainWindow.setTabOrder(self.cbx150, self.chk160)
        MainWindow.setTabOrder(self.chk160, self.cbx160)
        MainWindow.setTabOrder(self.cbx160, self.chk170)
        MainWindow.setTabOrder(self.chk170, self.cbx170)
        MainWindow.setTabOrder(self.cbx170, self.cbx180)
        MainWindow.setTabOrder(self.cbx180, self.chk190)
        MainWindow.setTabOrder(self.chk190, self.cbx190)
        MainWindow.setTabOrder(self.cbx190, self.cbx200)
        MainWindow.setTabOrder(self.cbx200, self.chk210)
        MainWindow.setTabOrder(self.chk210, self.cbx210)
        MainWindow.setTabOrder(self.cbx210, self.chk220)
        MainWindow.setTabOrder(self.chk220, self.cbx220)
        MainWindow.setTabOrder(self.cbx220, self.cbx230)
        MainWindow.setTabOrder(self.cbx230, self.cbx240)
        MainWindow.setTabOrder(self.cbx240, self.chk250)
        MainWindow.setTabOrder(self.chk250, self.cbx250)
        MainWindow.setTabOrder(self.cbx250, self.cbx260)
        MainWindow.setTabOrder(self.cbx260, self.pbnParts)
        MainWindow.setTabOrder(self.pbnParts, self.pbnCopyright)
        MainWindow.setTabOrder(self.pbnCopyright, self.pbnAbout)
        MainWindow.setTabOrder(self.pbnAbout, self.pbnReset)
        MainWindow.setTabOrder(self.pbnReset, self.pbnCancel)

    def retranslateUi(self, MainWindow):
        _translate = QtCore.QCoreApplication.translate
        MainWindow.setWindowTitle(_translate("MainWindow", "Powerpoint Builder"))
        self.lblTitle.setText(_translate("MainWindow", "Powerpoint Builder"))
        self.cbxChurch.setItemText(0, _translate("MainWindow", "St Francis"))
        self.cbxChurch.setItemText(1, _translate("MainWindow", "St Marys"))
        self.lblMass.setText(_translate("MainWindow", "Mass Details"))
        self.lblParts.setText(_translate("MainWindow", "Powerpoint Parts"))
        self.lbl010.setText(_translate("MainWindow", "010 Welcome"))
        self.lbl020.setText(_translate("MainWindow", "020 Messages"))
        self.lbl030.setText(_translate("MainWindow", "030 Meditation"))
        self.lbl040.setText(_translate("MainWindow", "040 Entrance Hymn"))
        self.lbl050.setText(_translate("MainWindow", "050 Introductory Rite"))
        self.lbl060.setText(_translate("MainWindow", "060 Penitential Act"))
        self.lbl070.setText(_translate("MainWindow", "070 Gloria"))
        self.lbl080.setText(_translate("MainWindow", "080 Psalm"))
        self.lbl090.setText(_translate("MainWindow", "090 Alleluia"))
        self.lbl100.setText(_translate("MainWindow", "100 Gospel Acclamation"))
        self.lbl110.setText(_translate("MainWindow", "110 Creed"))
        self.lbl115.setText(_translate("MainWindow", "115 Special Prayer"))
        self.lbl120.setText(_translate("MainWindow", "120 Offertory Hymn"))
        self.lbl130.setText(_translate("MainWindow", "130 Invitation to Prayer"))
        self.lbl140.setText(_translate("MainWindow", "140 Preface Dialogue"))
        self.lbl150.setText(_translate("MainWindow", "150 Sanctus"))
        self.lbl160.setText(_translate("MainWindow", "160 Eucharistic Acclamation"))
        self.lbl170.setText(_translate("MainWindow", "170 Amen"))
        self.lbl180.setText(_translate("MainWindow", "180 Our Father"))
        self.lbl190.setText(_translate("MainWindow", "190 Agnus Dei"))
        self.lbl200.setText(_translate("MainWindow", "200 Behold"))
        self.lbl210.setText(_translate("MainWindow", "210 Communion Hymn"))
        self.lbl220.setText(_translate("MainWindow", "220 Post-Communion Hymn"))
        self.lbl230.setText(_translate("MainWindow", "230 Closing Prayer"))
        self.lbl240.setText(_translate("MainWindow", "240 Announcements"))
        self.lbl250.setText(_translate("MainWindow", "250 Concluding Hymn"))
        self.lbl260.setText(_translate("MainWindow", "260 Farewell"))
        self.lblPath.setText(_translate("MainWindow", "Running from ... path."))
        self.lblTrust.setText(_translate("MainWindow", "(This must be set as a Trusted Location in Powerpoint)"))
        self.pbnParts.setText(_translate("MainWindow", "Create Parts File"))
        self.pbnCopyright.setText(_translate("MainWindow", "Create Copyright File"))
        self.pbnAbout.setText(_translate("MainWindow", "About"))
        self.pbnReset.setText(_translate("MainWindow", "Reset"))
        self.pbnCancel.setText(_translate("MainWindow", "Cancel"))
        self.lblTick.setText(_translate("MainWindow", "(Tick if embedded music required)"))
        self.lblGui.setText(_translate("MainWindow", "GUI version:"))
        self.lblGuiVer.setText(_translate("MainWindow", "0.02A"))
        self.lblCodeVer.setText(_translate("MainWindow", "Code version:"))
        self.lbl24hour.setText(_translate("MainWindow", "24 hour"))


if __name__ == "__main__":
    import sys
    app = QtWidgets.QApplication(sys.argv)
    MainWindow = QtWidgets.QWidget()
    ui = Ui_MainWindow()
    ui.setupUi(MainWindow)
    MainWindow.show()
    sys.exit(app.exec_())


What I have tried:

Hacking around without really understanding!
Posted
Updated 4-Aug-21 18:25pm

Quote:
Hacking around without really understanding!

Well ... there is your problem.
"Hacking about", "guessing and hoping", "suck it and see": none of these are a development strategy that will hold up in the short term, much less the long term. You don't learn anything from it that is helpful - because you have no idea why it works when it finally does - and what you do produce is of very poor quality that will consume considerable resources when it needs to be modified. And it will - because it hasn't been written so much as thrown together!

There is no shortcut to being a good (or even no-longer-a-total-beginner) coder: you need to learn what you are doing, and practice, practice, practice until what you have been taught is second nature.

Throwing code together, hoping it will work, and asking others to fix it when it doesn't is a route that leads to depression and bewilderment. Get a book, or go on a course: learn the basics before you start on anything complicated!
 
Share this answer
 
Comments
JohnDoDoDo 3-Aug-21 17:27pm    
Hi Griff, thanks for your well-considered opinion, if not for your help. I didn't realise humour was prohibited...

FYI, I have a few decade's experience as a Senior Systems Engineer, and have done my share of production scripting in DOS, PowerShell & VBA. I am new to Python & QT, but I'm taking the trouble to learn it because my latest little project to help save a few lay-people 2-3 hours each a week will be more useful as a cross-platform solution (MS & Mac).

I am NOT a programmer, but I understand concepts of functional programming, OOP, code reusability, style, etc. My particular method of learning is to have a crack, and clean it up as my understanding of the problem develops. Learning by doing, and figuring out how it works as I go. My retention is not that good when I go on a course to learn something, if I don't have a real-world problem to solve straight away. If it is necessary to go on a formal course for tens of hours before trying something, the world would be a much less productive place.

I'm not quite sure why you took the trouble to reply to my post; do you actually know what the cause of the error is? If you're just looking for someone to put down, look elsewhere.
Hey Griff, just in case someone else as stupid as me who shouldn't be programming comes up with the same problem...

CAUSE:

I was running setupUi() twice; once in __init__, once in __main__.
How dumb is that!

SOLUTION:

Remove the ui.setupUi(MainWindow) statement from __main__.
Easy!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900