How do u run a .py file when a button is clicked when using qt Creator

Viewed 166

I was able to create an interface using qt Creator for the frontend of a loan app in Python. Now I want it to separately display or push a display in the stack view which will display a wizard kind of window. I can't seem to make the wizard file which I converted from .ui format run when the button is triggered.

I used the qt designer in the qt creator IDE to create the wizard.

import QtQuick 2.15
import QtQuick.Window 2.15
import QtQuick.Controls 2.15

Window {
    width: 640
    height: 480
    visible: true
    title: qsTr("Hello World")

    Rectangle {
        id: rectangle
        color: "#ffffff"
        anchors.fill: parent

        Button {
            id: button
            text: qsTr("Button")
            anchors.right: parent.right
            anchors.bottom: parent.bottom
            anchors.rightMargin: 0
            anchors.bottomMargin: 0
            onClicked: stackView.push(Qt.resolvedUrl("wizard.py"))
        }

        Rectangle {
            id: rectangle1
            color: "#ffffff"
            anchors.left: parent.left
            anchors.right: parent.right
            anchors.top: parent.top
            anchors.bottom: button.top
            anchors.leftMargin: 10
            anchors.bottomMargin: 10
            anchors.rightMargin: 10

            StackView {
                id: stackView
                width: 200
                height: 200
                initialItem: Qt.resolvedUrl("homePage.qml")
            }
        }
    }
}

Throws the following error:

traceback >>file://(.py file location) 1 Expected token `numeric literal'
0 Answers
Related