This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tkinter as tk | |
banana=r"banana.gif" | |
bodercolor = [('aliceblue', '#F0F8FF'), ('blue', '#0000FF'), ('beige', '#F5F5DC'), | |
('cornsilk', '#FFF8DC'), ('red', '#ff0000'), ('lightgreen', '#90EE90'), | |
] | |
class BgChange: | |
(1)________________________________________ | |
def __call__(self, event=None): | |
self.label.configure(bg=self.color) | |
class MyWindow(tk.Frame): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tkinter as tk | |
banana=r"banana.gif" | |
bodercolor = [('aliceblue', '#F0F8FF'), ('blue', '#0000FF'), ('beige', '#F5F5DC'), | |
('cornsilk', '#FFF8DC'), ('red', '#ff0000'), ('lightgreen', '#90EE90'), | |
] | |
class BgChange: | |
(1)________________________________________ | |
def __call__(self, event=None): | |
self.label.configure(bg=self.color) | |
class MyWindow(tk.Frame): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import re | |
import json | |
daum_url="http://search.daum.net/search?w=tot&DA=YZR&t__nil_searchbox=btn&sug=&sugo=&q=%EC%98%81%ED%99%94" | |
html=requests.get(daum_url).text | |
matched=re.search(r'categoryIssueObj["38"]=(.+?);',html, re.S) | |
print(matched) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def view_question(request, pk, seq): | |
previous = request.GET.get('previous') | |
if not previous: | |
previous = request.POST.get('previous') | |
if previous: | |
previous_info = UserScore.objects.get(id=previous) | |
else: | |
previous_info = None | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Answer(models.Model): | |
question=models.ForeignKey(Question) # Question에서 상속 받은 인덱스를 넣어준다. | |
contents=models.CharField(max_length=250) | |
sequence=models.IntegerField(default=0) | |
code=models.CharField(max_length=2) # 사용자의 대답을 받는 변수 code | |
created=models.DateTimeField(auto_now_add=True) | |
updated=models.DateTimeField(auto_now=True) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.contrib import admin | |
from .models import Quiz | |
from .models import Question | |
from .models import Answer | |
from .models import UserScore | |
from .models import Result | |
class QuizAdmin(admin.ModelAdmin): | |
list_display = ['id', 'title', 'created', 'updated'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Quiz(models.Model): | |
title=models.CharField(max_length=250) | |
image=models.ImageField( | |
upload_to='quiz/%Y/%m/', | |
null=True, blank=True, | |
) | |
subcopy=models.TextField(null=False) # <== 모델에 서브카피라는 변수를 지정해서 텍스트 필드 객체를 만들고 싶은데 | |
created=models.DateTimeField(auto_now_add=True) | |
updated=models.DateTimeField(auto_now=True) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Animal이라는 동물 클래스를 정의 하고 | |
class Animal(object): | |
hp=100 #hp 체력값을 정의 해줬는데.... | |
attack_point=5 | |
def eat(self): | |
print("먹는다") | |
def move(self): | |
print("기어다닌다") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Animal이라는 동물 클래스를 정의 하고 | |
class Animal(object): | |
hp=100 #hp 체력값을 정의 해줬는데.... | |
attack_point=5 | |
def eat(self): | |
print("먹는다") | |
def move(self): | |
print("기어다닌다") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Triangle(): | |
def __init__(self,width,height): | |
self.width=width | |
self.height=height | |
def area(self): | |
self.result=(self.width*self.height)/2 | |
self.msg="넓이 {width}, 높이 {height}의 삼각형의 넓이는 {result}입니다".format(width=self.width, height=self.height, result=self.result) | |
return self.msg | |
def is_bigger_than(self,other): |
NewerOlder