Answer the question
In order to leave comments, you need to log in
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.
Answer the question
In order to leave comments, you need to log in
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())
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question