PyQt
-
- [PyQt] ๋ค์ด์ผ๋ก๊ทธ(Dialog)๋ค์ด์ผ๋ก๊ทธ(Dialog)๋ค์ด๊ฐ๋ฉฐPyQt์์ ๋ค์ด์ผ๋ก๊ทธ(Dialog)์ ์๋ฏธ์ ์ข ๋ฅ๋ฅผ ๊ฐ๋จํ๊ฒ ์ ๋ฆฌํด๋ณธ๋ค. ๋ค์ด์ผ๋ก๊ทธ(Dialog)๊ฐ๋ ์ฌ์ฉ์์ ์ํธ์์ฉํ๊ธฐ ์ํด ๋ํ๋๋ ๋ณ๊ฐ์ ์ฐฝ์ผ๋ฐ์ ์ผ๋ก ๋ค์ด์ผ๋ก๊ทธ๋ ์ฌ์ฉ์๋ก๋ถํฐ ์ ๋ ฅ์ ๋ฐ๊ฑฐ๋, ํ์ธ ๋ฐ ๊ฒฝ๊ณ ๋ฉ์์ง๋ฅผ ํ์ํ๋ ๋ฐ ์ฌ์ฉ๋๋ค. ์ข ๋ฅPyQt์์๋ ์ฃผ๋ก @QDialog@ ํด๋์ค๋ฅผ ์ฌ์ฉํ์ฌ ๋ค์ด์ผ๋ก๊ทธ๋ฅผ ๊ตฌํํ๋ค.PyQt์์ ๋ค์ด์ผ๋ก๊ทธ๋ ๋ค์๊ณผ ๊ฐ์ 2๊ฐ์ง ํํ๋ก ์ ๊ณต๋๋ค. 1๏ธโฃ ๋ชจ๋ฌ ๋ค์ด์ผ๋ก๊ทธ(Modal Dialog)์ฌ์ฉ์์๊ฒ ํด๋น ์ฐฝ๊ณผ ์ํธ์์ฉ์ ์๋ฃํ๊ธฐ ์ ๊น์ง๋ ๋ค๋ฅธ ์ฐฝ๊ณผ์ ์ํธ์์ฉ์ ํ์ฉํ์ง ์๋๋ค.@exec_()@ ๋ฉ์๋๋ฅผ ํธ์ถํ์ฌ ํ์ํ๋ฉฐ, ์ฌ์ฉ์๊ฐ ๋ค์ด์ผ๋ก๊ทธ๋ฅผ ๋ซ๊ธฐ ์ ๊น์ง ๋ค๋ฅธ ์ฐฝ๊ณผ์ ์ํธ์์ฉ์ ์ฐจ๋จํ๋ค. 2๏ธโฃ ๋ชจ๋ธ๋ฆฌ์ค(๋น๋ชจ๋ฌ) ๋ค์ด์ผ๋ก๊ทธ(Mode..
2025.02.25 -
- [PyQt] ํ ์ด๋ธ(QTableWidget) ๋ด์ฉ ์ง์ฐ๋ ๋ฐฉ๋ฒํ ์ด๋ธ(QTableWidget) ๋ด์ฉ ์ง์ฐ๋ ๋ฐฉ๋ฒ๋ค์ด๊ฐ๋ฉฐPyQt์ ํ ์ด๋ธ(QTableWidget)์ ๋ด์ฉ์ ์ง์ฐ๋ ๋ฐฉ๋ฒ์ ์ ๋ฆฌํด๋ณธ๋ค. ๋ด์ฉ๋ฐฉ๋ฒ โ : @setRowCount(0)@ ํ ์ด๋ธ์ ํ ์๋ฅผ 0๊ฐ๋ก ์ค์ ํ์ฌ ๋ชจ๋ ๋ฐ์ดํฐ๋ฅผ ์ญ์ ํ๋ ๋ฐฉ๋ฒ์ด๋ค.๋น ๋ฅด๊ณ ๊ฐ๋จํ๊ฒ ํ ์ด๋ธ์ ํ๊ณผ ๋ฐ์ดํฐ๋ฅผ ์ฆ์ ์ ๊ฑฐํ๋ค.์ด ํค๋(Header)๋ ๊ทธ๋๋ก ์ ์ง๋๋ค.table_widget.setRowCount(0) ๋ฐฉ๋ฒ โก : @clearContents()@ํ ์ด๋ธ์ ์ ๋ฐ์ดํฐ๋ฅผ ๋น์ฐ์ง๋ง, ํ๊ณผ ์ด์ ๊ตฌ์กฐ๋ ์ ์งํ๋ ๋ฐฉ๋ฒ์ด๋ค.์ด ํค๋์ ํ์ ๊ตฌ์กฐ๋ฅผ ์ ์งํ๋ฉด์ ๋ฐ์ดํฐ๋ฅผ ์ญ์ ํ๋ค.๊ธฐ์กด์ ์ค์ ํ ํ ์์ ์ด ์๋ฅผ ์๋์ผ๋ก ์ด๊ธฐํํ๋ ค๋ฉด ์ถ๊ฐ ์์ ์ด ํ์ํ๋ค.table_widget.clearContents() ๋ฐฉ๋ฒ โข : ๋ชจ๋ ํ์ ๋ฐ๋ณตํ์ฌ..
2025.01.16 -
- [PyQt] self.function(param)๊ณผ function(self, param)์ ์ฐจ์ด์ self.function(param)๊ณผ function(self, param)์ ์ฐจ์ด์ ๋ค์ด๊ฐ๋ฉฐPyQt๋ฅผ ์ด์ฉํ์ฌ ๊ฐ๋ฐ์ ํ ๋, ์ธ์ @self.function(param)@ ๋๋ @function(self, param)@๋ฅผ ์จ์ผํ ์ง ํท๊ฐ๋ฆด ๋๊ฐ ์๋ค.์ด ๋์ ์ฐจ์ด์ ์ ๋ํด ์ ๋ฆฌํด๋ณธ๋ค. self๊ฐ๋ ํ์ด์ฌ ํด๋์ค์ ์ธ์คํด์ค ๋ฉ์๋์์ ํ์ฌ ๊ฐ์ฒด ์์ ์ ์ฐธ์กฐํ๊ธฐ ์ํ ์ฒซ ๋ฒ์งธ ๋งค๊ฐ๋ณ์ํด๋์ค์ ์ธ์คํด์ค(๊ฐ์ฒด) ์์ ์ ์ฐธ์กฐํ๋ ๋ณ์ํด๋์ค ๋ด์์ ์ ์๋ ๋ฉ์๋๊ฐ ํธ์ถ๋ ๋ ์๋์ผ๋ก ํด๋น ๋ฉ์๋๊ฐ ์ํ ๊ฐ์ฒด๋ฅผ ๊ฐ๋ฆฌํค๋๋ก ํ๋ค.ํด๋์ค์ ๊ฐ์ฒด ์งํฅ ํ๋ก๊ทธ๋๋ฐ(OOP)์์ ๋งค์ฐ ์ค์ํ ๊ฐ๋ ๋ฉ์๋ ๋ด์์ ๊ฐ์ฒด์ ์์ฑ์ด๋ ๋ค๋ฅธ ๋ฉ์๋์ ์ ๊ทผํ ๋ ์ฌ์ฉ @self@๋ ๋ฉ์๋ ๋ด์์ ๊ฐ์ฒด์ ์์ฑ๊ณผ ๋ค๋ฅธ ๋ฉ์๋์ ์ ๊ทผํ ์ ์..
2024.10.12 -
- [PyQt] QTableWidget ์์ ํญ๋ชฉ ๊ฒ์ ๋ฐ ๋ณต์ ๊ธฐ๋ฅ ๊ตฌํ ๋ฐฉ๋ฒQTableWidget ์์ ํญ๋ชฉ ๊ฒ์ ๋ฐ ๋ณต์ ๊ธฐ๋ฅ ๊ตฌํ ๋ฐฉ๋ฒ๋ค์ด๊ฐ๋ฉฐPyQt์ @QTableWidget@ ์์ ํญ๋ชฉ์ ๊ฒ์ํ๊ณ , ์๋์ ๋ด์ฉ์ ๋ณต์ ์ํค๋ ๋ฐฉ๋ฒ์ ์ ๋ฆฌํด๋ณธ๋ค. ๋ฐฉ๋ฒ๊ฒ์ํ๊ณ ์ ํ๋ ๋ด์ฉ์ด ํด๋น ํ์ ์์ ๊ฒฝ์ฐ ํ์ํ๊ณ , ๊ทธ๋ ์ง ์์ ๊ฒฝ์ฐ ์จ๊ธฐ๋ ๋ฐฉ๋ฒ์ ์ด์ฉํ๋ค.from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout, QTableWidget, QTableWidgetItem, QPushButton, QLineEditclass SearchResetTableApp(QWidget): def __init__(self): super(SearchResetTableApp, self).__init__() self.ini..
2024.01.29 -
- [PyQt] QTableWidget๊ณผ SQLite3๋ฅผ ์ฐ๋ํ์ฌ ๊ตฌํํ CRUD ํ๋ก๊ทธ๋จQTableWidget๊ณผ SQLite3๋ฅผ ์ฐ๋ํ์ฌ ๊ตฌํํ CRUD ํ๋ก๊ทธ๋จ ๋ค์ด๊ฐ๋ฉฐ QTableWidget๊ณผ SQLite3๋ฅผ ์ฐ๋ํ์ฌ ๊ฐ๋จํ๊ฒ ๊ตฌํํ CRUD ํ๋ก๊ทธ๋จ ์์ค ์ฝ๋๋ฅผ ์ ๋ฆฌํด๋ณธ๋ค. ์์ค ์ฝ๋ import sys import sqlite3 from PyQt5.QtWidgets import QApplication, QMainWindow, QWidget, QVBoxLayout, QHBoxLayout, QPushButton, QLineEdit, QTableWidget, QTableWidgetItem, QLabel, QMessageBox class MainWindow(QMainWindow): def __init__(self): super().__init__() self.setWindowTitle("C..
2023.11.27 -
- [PyQt] ํ๋ซํผ ๋ ๋ฆฝ์ ์ธ(Platform Independent) ์คํ์ผ ์ ์ฉํ๋ ๋ฐฉ๋ฒ (Fusion)PyQt์์ ํ๋ซํผ ๋ ๋ฆฝ์ ์ธ(Platform Independent) ์คํ์ผ ์ ์ฉํ๋ ๋ฐฉ๋ฒ (Fusion) ๋ค์ด๊ฐ๋ฉฐ ์๋์ฐ์ ๋งฅ์์ ํ์๋๋ PyQt ํ๋ก๊ทธ๋จ์ ๋ชจ์ต์ ๋ค๋ฅด๋ค. ๊ทธ ์ด์ ๋ ํ๋ซํผ์ ์ํฅ์ ๋ฐ๊ธฐ ๋๋ฌธ์ด๋ค. ์ด๋ ๊ฒ ํ๋ซํผ์ ์ํฅ์ ๋ฐ์ง ์๊ณ , OS์ ์๊ด์์ด ๋์ผํ๊ฒ PyQt ํ๋ก๊ทธ๋จ์ด ํํ๋๋๋ก ํ๋ ๋ฐฉ๋ฒ์ด ์๋ค. ๋ฐฉ๋ฒ PyQt์์๋ ํ๋ซํผ ๋ ๋ฆฝ์ (Platform Independent)์ธ ์คํ์ผ ํ๋ฌ๊ทธ์ธ์ธ @Fusion@์ ์ ๊ณตํ๋ค. ์ด ์คํ์ผ ํ๋ฌ๊ทธ์ธ์ ์ด์ฉํ์ฌ ์คํ์ผ์ ์ ์ฉ์ํค๋ฉด OS์ ์๊ด ์์ด ๋์ผํ UI๊ฐ ํ์๋ ์ ์๋๋ก ํ ์ ์๋ค. ์ด ์คํ์ผ ํ๋ฌ๊ทธ์ธ์ ์ฌ์ฉํ๊ธฐ ์ํด์๋ ๋ค์๊ณผ ๊ฐ์ด @QStyleFactory@ ๋ชจ๋์ ๋ถ๋ฌ์์ผ ํ๋ค. from PyQt5.QtGui import ..
2023.09.21 -
- [PyQt] ๋งฅ(Mac)์์ ์๋์ฐ(Windows)์ ๋น์ทํ๊ฒ ๋ฉ๋ด ํ์ํ๋ ๋ฐฉ๋ฒ๋งฅ(Mac)์์ ์๋์ฐ(Windows)์ ๋น์ทํ๊ฒ ๋ฉ๋ด ํ์ํ๋ ๋ฐฉ๋ฒ๋ค์ด๊ฐ๋ฉฐํ ์ค์ ์ฝ๋๋ฅผ ๋ฃ์์ผ๋ก์จ ๋งฅ์์ ์คํ๋๋ PyQt์ ๋ฉ๋ด๊ฐ ์๋์ฐ์ ๋น์ทํ๊ฒ ํํ๋๋๋ก ๋ง๋ค ์ ์๋ค. ๋ฐฉ๋ฒmenubar.setNativeMenuBar(False) ์ฐธ๊ณ ์ฌ์ดํธ 06) ๋ฉ๋ด๋ฐ ๋ง๋ค๊ธฐ - GUI ์ดํ๋ฆฌ์ผ์ด์ ์์ ๋ฉ๋ด๋ฐ(menu bar…wikidocs.net
2023.09.21 -
- [PyQt] QTableWidget์ 1,000 ๋จ์๋ก ์ผํ(,)๋ฅผ ์ถ๊ฐํ๊ณ ์ซ์ ์ ๋ ฌ ๊ธฐ๋ฅ ์ถ๊ฐํ๊ธฐQTableWidget์ 1,000 ๋จ์๋ก ์ผํ(,)๋ฅผ ์ถ๊ฐํ๊ณ ์ซ์ ์ ๋ ฌ ๊ธฐ๋ฅ ์ถ๊ฐํ๊ธฐ ๋ค์ด๊ฐ๋ฉฐ PyQt5์์ @QTableWidget@์ ๊ฐ์ ๋ฃ์ ๋, ๊ธฐ๋ณธ์ ์ผ๋ก @string@ ํ์์ ๊ฐ์ด ๋ค์ด๊ฐ๊ฒ ๋๋ค.(@int@ํ์ ๊ฐ์ ๋ฃ์ ์ ์๋ค.) ์ด ๋, @QTableWidget@์ (@string@ ํ์) ์ซ์๋ฅผ ๋ฃ์ ๋ 1,000 ๋จ์๋ก ์ผํ(@,@)๋ฅผ ์ถ๊ฐํ๊ณ , ์ ๋ ฌ(์ค๋ฆ์ฐจ์/๋ด๋ฆผ์ฐจ์)์ ํ ์ ์๋๋ก ๊ตฌํํด๋ณด์. ์ค์ต์ ์ํ QTableWidget ๊ฐ์ฒด ์์ฑ ํ๊ธฐ ๋ค์๊ณผ ๊ฐ์ด ์ค์ต์ ์ํด ํ์ํ @QTableWidget@ ๊ฐ์ฒด๋ฅผ ์์ฑํ๋ค. self.table_widget = QTableWidget(self) self.table_widget.setGeometry(50, 50, 400, 200) ..
2023.07.20 -
- [PyQt] ๊ฐ๋จํ CRUD(Create, Read, Update, Delete) ํ๋ก๊ทธ๋จ๊ฐ๋จํ CRUD(Create, Read, Update, Delete) ํ๋ก๊ทธ๋จ ๋ค์ด๊ฐ๋ฉฐ PyQt5๋ก ๊ฐ๋จํ CRUD(Create, Read, Update, Delete) ๊ธฐ๋ฅ์ ์ํํ ์ ์๋ ํ๋ก๊ทธ๋จ์ ๋ง๋ค์ด๋ณด์. ์ฝ๋ @QTextEdit@ ์์ ฏ์ ์ด์ฉํ์ฌ CRUD ๊ธฐ๋ฅ์ ์ํํ ์ ์๋ ๋ฉ๋ชจ์ฅ๊ณผ ๋น์ทํ ํ๋ก๊ทธ๋จ์ด๋ค. import sys from PyQt5.QtWidgets import QApplication, QMainWindow, QTextEdit, QAction, QFileDialog class TextEditor(QMainWindow): def __init__(self): super().__init__() self.initUI() def initUI(self): self.textEdit = QT..
2023.07.18 -
- [PyQt] QTimer.singleShot ํจ์๋ฅผ ํน์ ์๊ฐ ๊ฐ๊ฒฉ์ผ๋ก ์ฌ๋ฌ๋ฒ ์คํํ๋ ๋ฐฉ๋ฒQTimer.singleShot ํจ์๋ฅผ ํน์ ์๊ฐ ๊ฐ๊ฒฉ์ผ๋ก ์ฌ๋ฌ๋ฒ ์คํํ๋ ๋ฐฉ๋ฒ๋ค์ด๊ฐ๋ฉฐ@PyQt5@์์ @QTimer.singleShot@ ํจ์๋ฅผ ํน์ ์๊ฐ ๊ฐ๊ฒฉ์ผ๋ก ์ฌ๋ฌ๋ฒ ์คํํ ์ ์๋ค.@QTimer.singleShot@ ํจ์๋ ๋ฐ๋ฆฌ์ด ๋จ์์ ์๊ฐ ์ง์ฐ์ ์ค ํ, ํน์ ํจ์๋ฅผ ์คํํด์ฃผ๋ ํจ์์ด๋ค. ์์ ๋ค์์ @QTimer.singleShot@ ํจ์๋ฅผ 3์ด ๊ฐ๊ฒฉ์ผ๋ก ์ฌ๋ฌ ๋ฒ ์คํํ๋ ์์ ์ด๋ค.๋ฐ๋ณต๋ฌธ๊ณผ ์ฌ๊ท ํธ์ถ์ ์ด์ฉํ์ฌ ๊ตฌํํ์๋ค.from PyQt5.QtCore import QTimerclass MyClass: def __init__(self): self.count = 0 def start_timer(self): self.count = 0 self.r..
2023.07.16 -
- [PyQt] QAction์์ triggered ์๊ทธ๋์ ์ฌ์ฉํ ๋, ์ธ์๋ฅผ triggered ๋ฉ์๋์ ์ ๋ฌํ๋ ๋ฐฉ๋ฒQAction์์ triggered ์๊ทธ๋์ ์ฌ์ฉํ ๋, ์ธ์๋ฅผ triggered ๋ฉ์๋์ ์ ๋ฌํ๋ ๋ฐฉ๋ฒPyQt์ @QAction@์์ @triggered@ ์๊ทธ๋์ ์ฌ์ฉํ ๋, ์ธ์๋ฅผ @triggered@ ๋ฉ์๋์ ์ ๋ฌํ๋ ๋ฐฉ๋ฒ์ ์์๋ณด์. ๋๋ค ํจ์ ์ฌ์ฉํ๊ธฐaction = QAction("My Action", parent)action.triggered.connect(lambda: my_function(arg1, arg2))my_function์ arg1๊ณผ arg2๋ฅผ ์ธ์๋ก ๋ฐ๋ ํจ์์ด๋ค.triggered ์๊ทธ๋์ด ๋ฐ์ํ๋ฉด, ๋๋ค ํจ์๊ฐ ํธ์ถ๋๊ณ my_function์ด ํธ์ถ๋๋ค.arg1๊ณผ arg2๋ ๋๋ค ํจ์์์ ์ง์ ์ ๋ฌ๋๋ค. @functools.partial@ ์ฌ์ฉํ๊ธฐimport functoolsa..
2023.07.08 -
- [PyQt] QClipboard.Clipboard์ QClipboard.Selection์ ์ฐจ์ด์ PyQt5์์ @QClipboard.Clipboard@์ @QClipboard.Selection@์ ์ฐจ์ด์ ๋ค์ด๊ฐ๋ฉฐ@QClipboard.Clipboard@์ @QClipboard.Selection@์ PyQt์์ ํด๋ฆฝ๋ณด๋์ ๋ฐ์ดํฐ๋ฅผ ์ค์ ๋ฐ ๊ฐ์ ธ์ค๋ ๋ฐฉ๋ฒ์ ์ง์ ํ๋ ์์์ด๋ค. ์ฌ์ฉ๋ฒ๋ค์ ๋ชจ๋์ @import@ํ์ฌ ํด๋ฆฝ๋ณด๋ ๊ธฐ๋ฅ์ ์ฌ์ฉํ ์ ์๋ค.from PyQt5.QtGui import QClipboard ์ฌ์ฉ ์def copyElementNameToClipboard(self): name = self.sender().text() app = QApplication.instance() clipboard = app.clipboard() clipboard.setText(name, QClipb..
2023.07.07 -
- [PyQt] ์ปค์คํ ์์ด์ฝ ํจํค์ง(fugueicons) ์ค์น ๋ฐ ์ฌ์ฉํด๋ณด๊ธฐPyQt ์ปค์คํ ์์ด์ฝ ํจํค์ง(fugueicons) ์ค์น ๋ฐ ์ฌ์ฉํด๋ณด๊ธฐ ๋ค์ด๊ฐ๋ฉฐ PyQt์๋ ๊ธฐ๋ณธ ์์ด์ฝ ํฉ์ด ์์ง๋ง(์ฐธ๊ณ ), ์์ด์ฝ์ ์ข ๋ฅ๊ฐ ์ ๋ค. ๊ทธ๋์ ์ปค์คํ ์์ด์ฝ ํจํค์ง(@fugueicons@)๋ฅผ ์ค์นํ์ฌ ์ฌ์ฉํ ์ ์๋ค. ๋ฐฉ๋ฒ @pyqt5-fugeicons@ ํจํค์ง ์ค์นํ๊ธฐ ํฐ๋ฏธ๋์์ ๋ค์ ๋ช ๋ น์ ์คํํ์ฌ @pyqt5-fugeicons@ ํจํค์ง๋ฅผ ์ค์นํ๋ค. > pip install pyqt5-fugueicons ์์ด์ฝ ์ฌ์ฉํด๋ณด๊ธฐ ๋ค์๊ณผ ๊ฐ์ด ๋ชจ๋์ ๋ถ๋ฌ์@fugeicons@์ ์์ด์ฝ์ ์ฌ์ฉํด๋ณผ ์ ์๋ค. import pyqt5_fugueicons as fugue @icon()@ ๋ฉ์๋๋ฅผ ์ฌ์ฉํ์ฌ ์์ด์ฝ์ ๋ถ๋ฌ์ฌ ์ ์๋ค. PyQt ๊ธฐ๋ณธ ์์ด์ฝํฉ์ ์์ด์ฝ์ ์ฌ์ฉํ๋ ๋ฐฉ๋ฒ๊ณผ ์ ์ฌํ๋ค. @QActi..
2023.07.05 -
- [PyQt] style().standardIcon() ๋ฉ์๋์์ ์ฌ์ฉํ ์ ์๋ ์์ด์ฝ ์ข ๋ฅ ๋ฐ ์ซ์PyQt style().standardIcon() ๋ฉ์๋์์ ์ฌ์ฉํ ์ ์๋ ์์ด์ฝ ์ข ๋ฅ ๋ฐ ์ซ์ ๋ค์ด๊ฐ๋ฉฐ PyQt์๋ ๊ธฐ๋ณธ์ ์ผ๋ก ๋ด์ฅ๋์ด ์๋ ํ์ค ์์ด์ฝ(Standard Icon)๋ค์ด ์๋ค. ์์ด์ฝ ํ์ผ์ ์ง์ ๊ตฌํ์ง ์๊ณ ์ฌ์ฉํ ์ ์์ผ๋ฏ๋ก, ํ๋ก๊ทธ๋จ์ ๋ง๋ค ๋ ํ์ฉํ๋ฉด ์ ์ฉํ๋ค. ์์ด์ฝ ํ์ธํด๋ณด๊ธฐ import sys from PyQt5.QtWidgets import QApplication, QGridLayout, QPushButton, QStyle, QWidget class Window(QWidget): def __init__(self): super(Window, self).__init__() icons = sorted([attr for attr in dir(QStyle) if attr.start..
1 2023.05.17 -
- [PyQt] PyQt5์์ QWebView ์ฌ์ฉํ๊ธฐPyQt5์์ QWebView ์ฌ์ฉํ๊ธฐ๋ค์ด๊ฐ๋ฉฐ์๋ PyQt์์ @QWebView@ ์์ ฏ์ ์ฌ์ฉํ ์ ์์์ผ๋, PyQt5์์๋ถํฐ๋ ๋ ์ด์ ๊ธฐ๋ณธ์ผ๋ก ์ ๊ณต๋์ง ์๊ฒ ๋์๋ค.๋ฐ๋ผ์ @QWebView@ ์์ ฏ์ ์ฌ์ฉํ๋ ค๋ฉด @QWebEngineView@ ๋ชจ๋์ ์ฌ์ฉํด์ผ ํ๋ค. ๊ทธ๋ฆฌ๊ณ @QWebView@ ๊ฐ์ฒด๊ฐ ์๋, @QWebEngineView@ ๊ฐ์ฒด๋ฅผ ์ฌ์ฉํ๋ค. ๋ฐฉ๋ฒ๋ค์์ ๋ช ๋ น์ ํฐ๋ฏธ๋์์ ์คํํ์ฌ @QWebEngineView@๋ฅผ ์ฌ์ฉํ๊ธฐ ์ํด ํ์ํ ํจํค์ง๋ฅผ ์ค์นํ๋ค.> pip install PyQtWebEngine ๋ค์๊ณผ ๊ฐ์ด @import@ ํ์ฌ ์ฌ์ฉํ๋ค.from PyQt5.QtCore import QUrlfrom PyQt5.QtWidgets import QApplication, QWidgetfrom Py..
2023.05.16 -
- [PyQt] ๊ตฌ๊ธ ๋ฒ์ญ๊ธฐ ํ๋ก๊ทธ๋จ ๋ง๋ค๊ธฐ & "'NoneType' object has no attribute 'group'" ์ด์ ํด๊ฒฐํ๊ธฐPyQt๋ก ๊ตฌ๊ธ ๋ฒ์ญ๊ธฐ ํ๋ก๊ทธ๋จ ๋ง๋ค๊ธฐ๋ค์ด๊ฐ๋ฉฐPyQt๋ฅผ ์ด์ฉํ์ฌ ๊ฐ๋จํ๊ฒ ํ๊ธ์ ๋ฌธ์ฅ์ ์์ด ๋ฌธ์ฅ์ผ๋ก ๋ฒ์ญํ๋ ํ๋ก๊ทธ๋จ์ ๋ง๋ค์ด๋ณด์.์ด๋, ๋ฌด๋ฃ๋ก ์ฌ์ฉํ ์ ์๋ ๊ตฌ๊ธ ๋ฒ์ญ๊ธฐ ํจํค์ง(@googletrans@)๋ฅผ ์ฌ์ฉํ๋๋ก ํ๋ค. ์ฝ๋import sysfrom PyQt5.QtWidgets import *from googletrans import Translatorclass MyApp(QWidget): def __init__(self): super().__init__() self.lbl1 = QLabel('ํ๊ตญ์ด:', self) self.lbl2 = QLabel('์์ด:', self) self.le = QLineEdit(self) self..
2023.05.15 -
- [PyQt] self.width()์ self.height()๋ฅผ ์ฌ์ฉํ ๋, ์คํ์ฐฝ์ด ํ๊ธฐ๋ ๊ฒฝ์ฐ ํด๊ฒฐ ๋ฐฉ๋ฒPyQt์์ self.width()์ self.height()๋ฅผ ์ฌ์ฉํ ๋, ์คํ์ฐฝ์ด ํ๊ธฐ๋ ๊ฒฝ์ฐ ํด๊ฒฐ ๋ฐฉ๋ฒ๋ค์ด๊ฐ๋ฉฐPyQt์์ @self.width()@์ @self.height()@๋ฅผ ์ฌ์ฉํ ๋, ์คํ์ฐฝ์ด ํ๊ธฐ๋ ๊ฒฝ์ฐ๊ฐ ์๋ค.์๋ฅผ ๋ค์ด, @self.width()@ ๊ฐ๊ณผ @self.height()@ ๊ฐ์ ์ง์ ์ ์๋ก ๋๋์ด ์ฌ์ฉํ๋ ๊ฒฝ์ฐ ์คํ์ฐฝ์ด ํ๊ธฐ๊ฒ ๋๋ค.qp.drawPoint(self.width() / 2, self.height() / 2) ํด๊ฒฐ ๋ฐฉ๋ฒ@self.width() / 2@์ @self.height() / 2@์ ๊ฒฐ๊ณผ๊ฐ์ด ์ค์ํ(Float)์ด๊ธฐ ๋๋ฌธ์ ์คํ์ฐฝ์ด ํ๊ธฐ๊ฒ ๋๋ ๊ฒ์ด๋ค.๋ฐ๋ผ์ ๋ค์๊ณผ ๊ฐ์ด ์ ์ํ ํ์ ๋ณํ ํจ์ @int()@๋ฅผ ์ฌ์ฉํด์ค์ผ ํ๋ค.qp.drawPoint(int(se..
2023.05.14