PDA

View Full Version : How to create splash text



HonestMM
24th March 2020, 02:56
Hello,

Is it possible to create dynamic splash text instead of a splash screen?

I have a program (with its own main window) that every so often needs to display some dynamic text on the screen not just over the main window, but someplace on the screen. I don't want a background or any visible menus or borders, just the text. It seems like a splash screen might be the best approach, but please enlighten me!

Thank you

Working in PyQt5 and PySide2

d_stranz
24th March 2020, 18:00
The splash screen will be displayed in the center of the screen, and since it is borderless it can't be moved. You can use an ordinary QWidget-based class instead - just don't give it a parent QWidget when you create it, and it will be treated as a top-level widget like your QMainWindow. You can set window flags to remove the borders (if your OS / window manager allow that), but if you do and you want it to be moveable, you will have to implement code to handle mouse events on the widget to do that.

Here is a stackoverflow post (https://stackoverflow.com/questions/18765918/how-to-create-a-draggable-borderless-and-titleless-top-level-window-in-qt) that might help.

HonestMM
26th March 2020, 02:51
Many thanks, I will use a QWidget. I discovered a little program that shows how the different flags affect the window.

How can I make the window transparent except for the text? Have you seen examples of this?

d_stranz
26th March 2020, 16:54
There is a section in the QWidget class documentation that discusses transparency and translucency. You can probably also Google for examples.