Skip to content

Instantly share code, notes, and snippets.

View eyeray's full-sized avatar

Seo beom seok eyeray

  • zestad
  • seoul kangnam
View GitHub Profile
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):
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):
@eyeray
eyeray / gist:57a02e3430bb06f0c0cb112e50814089
Last active July 21, 2017 05:07
다음 실시간 영화순위
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)
@eyeray
eyeray / view_question.py
Last active November 8, 2016 01:41
퀴즈에서 선택지를 선택하지 않고 다음퀴즈 버튼을 눌렀을때
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
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)
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']
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)
@eyeray
eyeray / animal.py
Last active September 22, 2016 08:35
# Animal이라는 동물 클래스를 정의 하고
class Animal(object):
hp=100 #hp 체력값을 정의 해줬는데....
attack_point=5
def eat(self):
print("먹는다")
def move(self):
print("기어다닌다")
@eyeray
eyeray / py
Last active September 22, 2016 07:27
# Animal이라는 동물 클래스를 정의 하고
class Animal(object):
hp=100 #hp 체력값을 정의 해줬는데....
attack_point=5
def eat(self):
print("먹는다")
def move(self):
print("기어다닌다")
@eyeray
eyeray / py
Last active September 21, 2016 07:36
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):