I want to show a rectangle in Qml and I want to change the rectangle\'s properties(width, length) from my python code. In fact, there is a socket connection in the python co
Try some thing like below (Not tested, but will give you an idea).
create some objectname for rectangle as shown below:
Rectangle {
id: rectangle
x: 187
y: 92
width: 200
height: 200
color: "blue"
objectName: "myRect"
}
Interact with QML and find your child, then set the property.
#INTERACT WITH QML
engine = QQmlEngine()
component = QQmlComponent(engine)
component.loadUrl(QUrl('mainViewofHoomanApp.qml'))
object = component.create()
#FIND YOUR RECTANGLE AND SET WIDTH
child = object.findChild(QObject,"myRect")
child.setProperty("width", 500)