n0bel / PiClock

A Fancy Clock built around a monitor and a Raspberry Pi
MIT License
566 stars 182 forks source link

Frame 3 #154

Closed garry51 closed 5 years ago

garry51 commented 5 years ago

Can someone help please I have a pi weather station that has been working for about a year now it generates Rrd graphs as png images I would like to show them on frame 3 of my pi clock but alas I no nothing about style sheets so can someone show me how to put 4 png images on frame 3 please. Thanks

togatown commented 5 years ago

Create a label as a sub element of your frame 3:

imgcont = QtGui.QLabel(frame3)
imgcont.setObjectName("imgcont")
imgcont.setStyleSheet("imgcont { background-color: transparent; }")
imgcont.setGeometry(0, 0, 720 * xscale, 900 * yscale)

Then set the image to appear in the label:

myIconMap = QtGui.QPixmap( "pathandfilename.png")
imgcont.setPixmap(myIconMap.scaled(imgcont.size(), Qt.IgnoreAspectRatio, Qt.SmoothTransformation))
garry51 commented 5 years ago

Thanks for the help. I will try it today.

Cheers.

On 6 Apr 2019 5:19 pm, togatown notifications@github.com wrote:

Create a label as a sub element of your frame 3:

imgcont = QtGui.QLabel(frame3) imgcont.setObjectName("imgcont") imgcont.setStyleSheet("imgcont { background-color: transparent; }") imgcont.setGeometry(0, 0, 720 xscale, 900 yscale)

Then set the image to appear in the label:

myIconMap = QtGui.QPixmap( "pathandfilename.png") imgcont.setPixmap(myIconMap.scaled(imgcont.size(), Qt.IgnoreAspectRatio, Qt.SmoothTransformation))

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/n0bel/PiClock/issues/154#issuecomment-480516846, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AhC-yM9Oj3wRN1yBfOHwN9lLZtvavcpAks5veMkSgaJpZM4ceY-4.

garry51 commented 5 years ago

Thank's it works a treat you have made an old guy very happy. cherrs Garry

garry51 commented 5 years ago

The graph image displays ok but alas it wont update. I am sshpassing the image every 5mins to the clock (all working ok) but the clock only displays the image it has on boot up no refresh. Any ideas.

Thanks Garry

togatown commented 5 years ago

You'll have to create a routine to update the image every so often or apply it inside one of the existing loops.

garry51 commented 5 years ago

Its working ok now thanks for the help.