본문 바로가기

Python/Python 기초25

파이썬(QT) 오목게임 만들기 import sys from PyQt5 import(uic) from PyQt5.QtWidgets import QApplication, QMainWindow from PyQt5 import QtGui from PyQt5.Qt import QPushButton, QSize, QMessageBox form_class = uic.loadUiType("omok03.ui")[0] class WindowClass(QMainWindow, form_class): def __init__(self): super().__init__() self.flag_bw = True self.setupUi(self) self.arr2D = [ [0,0,0,0,0, 0,0,0,0,0], [0,2,1,2,0, 0,0,0,0,0], [0,1.. 2023. 7. 1.
파이썬(QT)야구게임 만들기 예제 from PyQt5 import uic from PyQt5.QtWidgets import * from random import random import sys form_class = uic.loadUiType("myqt08.ui")[0] class WindowClass(QMainWindow, form_class): def __init__(self): super().__init__() self.ranC() self.setupUi(self) self.pb.clicked.connect(self.myclick) self.le.returnPressed.connect(self.myclick) def getS(self,com,mine): ret = 0 c1 = com[0:1] c2 = com[1:2] c3 = com.. 2023. 6. 29.
파이썬(QT) 별찍기 예제 import sys from PyQt5 import(uic) from PyQt5.QtWidgets import QApplication, QMainWindow from random import random from sympy.printing import str form_class = uic.loadUiType("myqt07.ui")[0] class WindowClass(QMainWindow, form_class): def __init__(self): super().__init__() self.setupUi(self) self.pb.clicked.connect(self.myclick) def myclick(self): f = self.le_first.text() l = self.le_last.text() f.. 2023. 6. 29.
파이썬(QT) 가위바위보 프로그램 만들기 예제 import sys from PyQt5 import(uic) from PyQt5.QtWidgets import QApplication, QMainWindow from random import random form_class = uic.loadUiType("myqt06.ui")[0] class WindowClass(QMainWindow, form_class): def __init__(self): super().__init__() self.setupUi(self) self.pb.clicked.connect(self.myclick) def myclick(self): me = self.pte_mine.toPlainText() arr = ["가위","바위","보"] ran = int(random()*3) com .. 2023. 6. 29.
파이썬(QT) 전화번호 팝업창 띄우기 예제 import sys from PyQt5 import(uic) from PyQt5.QtWidgets import QApplication, QMainWindow import win32api form_class = uic.loadUiType("myqt05.ui")[0] class WindowClass(QMainWindow, form_class): def __init__(self): super().__init__() self.setupUi(self) self.pb0.clicked.connect(lambda :self.myclick(0)) self.pb1.clicked.connect(lambda :self.myclick(1)) self.pb2.clicked.connect(lambda :self.myclick(2).. 2023. 6. 28.
파이썬(QT) 구구단 입력 받아 출력 예제 import sys from PyQt5 import(uic) from PyQt5.QtWidgets import QApplication, QMainWindow form_class = uic.loadUiType("myqt04.ui")[0] class WindowClass(QMainWindow, form_class): def __init__(self): super().__init__() self.setupUi(self) self.pb.clicked.connect(self.myclick) def myclick(self): a=int(self.le.text()) b=""; for i in range(1,9+1): b += str(a) + "*" + str(i) + "=" + str(a*i)+"\n" self.te.. 2023. 6. 28.