S
S
siamsiam2016-11-15 14:27:44
Python
siamsiam, 2016-11-15 14:27:44

How to create a borderless launcher window for an application in Windows using png as a basis?

I’m reading tutorials on some GUIs for python and I can’t figure out how to display a simple png image on the screen and stick buttons on it. That is, I repeat, just png. So that there are no restrictions on the standard Windows window. An example is attached to the post.
Maybe I'm completely wrong, I'll be glad to any advice. If it can be implemented in other languages ​​​​and easier, then it will work too.
udDjfhZxhnA.jpg

Answer the question

In order to leave comments, you need to log in

2 answer(s)
T
TomasHuk, 2016-11-15
@siamsiam

I did this according to the book by Prokhorenok N.A. "Python 3 and PyQt. Application Development".
Code from there:

from PyQt4 import QtCore, QtGui
import sys
app = QtGui.QApplication(sys.argv) 
window = QtGui.QWidget() 
window.setWindowFlags(QtCore.Qt.Window | QtCore.Qt.FramelessWindowHint)
window.setWindowTitle("Создание окна произвольной формы")
window.resize(300, 300)
pixmap = QtGui.QPixmap("fon.png")
pal = window.palette() 
pal.setBrush(QtGui.QPalette.Normal, QtGui.QPalette.Window, QtGui.QBrush(pixmap))
pal.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Window, QtGui.QBrush(pixmap)) 
window.setPalette(pal)
window.setMask(pixmap.mask())
button = QtGui.QPushButton("Закрыть окно", window) 
button.setFixedSize(150, 30) 
button.move(75, 135) 
QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"), QtGui.qApp, QtCore.SLOT("quit()")) 
window.show()
sys.exit(app.exec())

Unfortunately, I don't have python handy to check. But it should run without problems.
PyQt4 installation required.
PS Corrected the code, everything works.

J
Jacob E, 2016-11-16
@Zifix

Try QML, it will be as simple as possible.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question