K-means 시뮬레이터
간단한 시뮬레이터다. 좀 경험이 쌓여서인지, 그전 것들보다 구현하기 쉬웠다. 이번에도 Python과 pygame을 사용해서 구현했다. import pygame import random def drawNode(nodeN, color): pygame.draw.circle(screen, color, dotToScreenDot(nodes[nodeN]), NODE_RADIUS, 3) screen.blit(font.render(f'#{nodeN}', True, color), dotToScreenDot((nodes[nodeN][0] - 5, nodes[nodeN][1] + 5))) def dotToScreenDot(a): return int(round(a[0])), int(round(SCREEN_SIZE[1]-a[1..
파이썬 예제[Python] wxpython , sqlite3이용해서 일기장 만들기
한 5일동안 만들었다.아직 완성은 아니지만, 뭐 완성품 올리는 블로그도 아니고, 꽤 잘 작동해서 올리게 되었다. DbManager.py이다.import sqlite3 import arrow import os class DbManager: def __init__(self): self.conn = sqlite3.connect(os.path.join(os.path.expanduser('~'), 'documents', 'Diary', 'Diary.db')) self.c = self.conn.cursor() def saveDiaryInfo(self, date, time, todayFeel, todayThoughtsCount, writer): sql = f'INSERT INTO Diary (date, time, t..