

There are 12 hours on the clock face and 360 degrees for a full rotation - so each hour the hour hand advances 360/12=30 degrees. The calculation for the rotation of the hour hand is hms.hours * 30. The origin is the point in the image around which we want to rotate - in our case, the center. The Rotation transform accepts parameters for the angle through which to rotate and the origin.x and origin.y. Finally, we modify the Connections object to add a handler for the hms signal named onHms.įunction onHms(hours, minutes, seconds) ] Then we need to add a signal handler which can take the incoming data from Python and store it into our QML property hms.

Next we need to add a new variable on the QML side to hold our time data - we'll be using a Javascript object named hms to keep the hours, minutes and seconds together in a single variable - similar to a Python dictionary. (local_time.tm_hour, local_time.tm_min, local_time.tm_sec) (self.update_time)Ĭurr_time = strftime("%H:%M:%S", local_time) If you run this version of the app, you will see a rectangular window with the current local time. You can also download these files as a zip file. In this folder add this background.png image to provide the background for the clock text. Place these files in a folder together, with an additional folder named images inside. Text: currTime // used to be text: "16:38:33"

Y: sktopAvailableHeight - height - 48įlags: Qt.FramelessWindowHint | Qt.Window
