본문 바로가기

Python97

파이썬(DJANGO)장고 post방식 예외처리 이걸 막아주면 전체 예외처리가 된다 @csrf_exempt를 사용해 이것만 예외처리 시킬 수 있다. # cat views.py from django.http import HttpResponse from django.views.decorators.csrf import csrf_exempt def hello(request): return HttpResponse("Hello world!!!") def param(request): menu = request.GET.get('menu','뇨끼') return HttpResponse(f"param!!!{menu}") @csrf_exempt def post(request): menu = request.POST['menu'] return HttpResponse("pos.. 2023. 7. 5.
장고 라이브러리 설치 및 기본세팅 장고 라이브러리 설치 2023. 7. 5.
파이썬(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.