2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Python3とPyQt5を使ってのGUIプログラミング(1)

Last updated at Posted at 2016-08-05

pythonを初めてまだ日がたってない学生なので知識は浅いです。
ほぼ備忘録のようなものになると思います。
#ウィンドウ表示

test.py
# coding: UTF-8

import sys
from PyQt5.QtWidgets import QApplication, QDesktopWidget, QWidget


class Test(QWidget):

    def __init__(self):
        app = QApplication(sys.argv)

        super().__init__()
        self.init_ui()
        self.show()

        app.exec_()

    def init_ui(self):
        self.setWindowTitle("PyQt5")
        self.resize(640, 400)
        self.frameGeometry()\
            .moveCenter(
                        QDesktopWidget()
                        .availableGeometry()
                        .center()
                        )


if __name__ == '__main__':
    Test()

image

これでウィンドウを画面中央に表示できるはず。

書き方がpythonかどうかはわからない
他に書き方があればぜひ教えて下さい。

2
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?