Flash and then black screen with nothing shown in the chart
Question
Hi Team,
I'm using lightweight-charts-python on Ubuntu 22.04. After I ran the code listed in Code example, it just popped up a window, a quick flash, and then end up with black screen with nothing shown in the chart.
After I closed window, it does not exit the application. I have press Ctrl+C to exit. Below is the output from Ctrl+C:
Below is output from pip list: Package Version
bottle 0.12.25 lightweight-charts 1.0.21 numpy 1.26.4 packaging 24.0 pandas 2.2.2 pip 24.0 proxy_tools 0.1.0 PyQt5 5.15.10 PyQt5-Qt5 5.15.2 PyQt5-sip 12.13.0 PyQtWebEngine 5.15.6 PyQtWebEngine-Qt5 5.15.2 python-dateutil 2.9.0.post0 pytz 2024.1 pywebview 5.1 QtPy 2.4.1 setuptools 58.1.0 six 1.16.0 typing_extensions 4.11.0 tzdata 2024.1
My Python version is 3.9.18. I installed Pywebview with "pip install pywebview[qt]".
Would you please help and let me know if you need more details of the issue?
Thanks, wei
Code example
import pandas as pd
from lightweight_charts import Chart
PYWEBVIEW_GUI="qt"
if __name__ == '__main__':
chart = Chart(debug=True)
# Columns: time | open | high | low | close | volume
df = pd.read_csv('ohlcv.csv')
chart.layout(background_color='#090008', text_color='#FFFFFF', font_size=16,
font_family='Helvetica')
chart.candle_style(up_color='#00ff55', down_color='#ed4807',
border_up_color='#FFFFFF', border_down_color='#FFFFFF',
wick_up_color='#FFFFFF', wick_down_color='#FFFFFF')
chart.volume_config(up_color='#00ff55', down_color='#ed4807')
chart.watermark('1D', color='rgba(180, 180, 240, 0.7)')
chart.crosshair(mode='normal', vert_color='#FFFFFF', vert_style='dotted',
horz_color='#FFFFFF', horz_style='dotted')
chart.legend(visible=True, font_size=14)
chart.set(df)
chart.show(block=True)
I got some similar problem with wayland. Try Xorg.
Actually I am using X11.
downgrade pywebview to version 4.3
pip install pywebview==4.3
Actually I am using X11.
I am using ubuntu, python version 3.12 . Try uninstalling the pip packages for everything starts with pyqt and then install pyqt5 + qtwebengine using apt.. The pip package of pyqtwebengine may be causing problem.
downgrade pywebview to version 4.3
pip install pywebview==4.3
Thanks for you advice! I tried to downgrade pywebview to version 4.3, and got below error when running code.
I havent worked with Qt but you might need to downgrade some Qt packages too is my guess. Try searching for old issues on this projekt and see if anyone has has similar issues
Thank you!
