Mar-22-2022, 10:04 AM
(This post was last modified: Mar-24-2022, 07:45 AM by BlindMate.
Edit Reason: No Code...
)
Hello,
I am a beginner in Python and I ran into some issues.
I want to creaate an App that shows me the real time Bitcoin proce.
I managed to getch tje data and print it to the terminal. But I want to see it in a PyQt5 App.
I made the PyQt5 window (GUI.ui), but I can't get them to work together.
So I need some help joining them together.
I don't lmow why, but I can't upload the HUI.ui file. But is just has a label named 'lblUSDPrice'
This is what I would like :
1. Update the lbale in real time.
2. The format I used, I'd like to keep.
I hope womeone can get me the help I need...
Thnx !!!
I am a beginner in Python and I ran into some issues.
I want to creaate an App that shows me the real time Bitcoin proce.
I managed to getch tje data and print it to the terminal. But I want to see it in a PyQt5 App.
I made the PyQt5 window (GUI.ui), but I can't get them to work together.
So I need some help joining them together.
I don't lmow why, but I can't upload the HUI.ui file. But is just has a label named 'lblUSDPrice'
This is what I would like :
1. Update the lbale in real time.
2. The format I used, I'd like to keep.
I hope womeone can get me the help I need...
Thnx !!!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
from PyQt5.QtWidgets import QMainWindow, QApplication, QLabel, QPushButton from PyQt5 import uic import sys, time, ccxt from babel.numbers import format_currency import json import websocket class UI(QMainWindow): def __init__( self ): super (UI, self ).__init__() # Load UI File uic.loadUi( "GUI.ui" , self ) # Set USD Label # self.lblUSDPrice = self.findChild(QLabel, "lblUSDPrice") # self.lblUSDPrice.setText(usd) # Show the App self .show() def on_open(ws): print ( "Open..." ) def dollars(ws, message): usd = json.loads(message) usd = str (usd[ 'c' ]) usd = (format_currency(usd, ' ', locale=' nl_NL')) print (usd) ws = websocket.WebSocketApp(socket, on_open = on_open, on_message = dollars) ws.run_forever() app = QApplication(sys.argv) UIWindow = UI() app.exec_() |
Output:Open...
43.066,35
43.068,04
43.068,04
43.068,05
43.068,05
Error:Until here it goes like I want, but when I add the label (I 'hashtagged' them out for now), I get nothing. It even doesn't load the Gui...
Maybe I am doing this the wring way all together?
Larz60+ write Mar-22-2022, 03:30 PM:
rather than using links:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
rather than using links:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.