티스토리 뷰
https://stackoverflow.com/questions/11328920/is-python-strongly-typed
Is Python strongly typed?
I've come across links that say Python is a strongly typed language. However, I thought in strongly typed languages you couldn't do this: bob = 1 bob = "bob" I thought a strongly typed language ...
stackoverflow.com
from tkinter import *
import math
# ---------------------------- CONSTANTS ------------------------------- #
PINK = "#e2979c"
RED = "#e7305b"
GREEN = "#9bdeac"
YELLOW = "#f7f5dd"
FONT_NAME = "Courier"
WORK_MIN = 10
SHORT_BREAK_MIN = 5
LONG_BREAK_MIN = 20
# ---------------------------- TIMER RESET ------------------------------- #
# ---------------------------- TIMER MECHANISM ------------------------------- #
def start_timer():
count_down(WORK_MIN * 60)
# ---------------------------- COUNTDOWN MECHANISM ------------------------------- #
# import time
# counter = 5
#
# while True:
# time.sleep(1)
# counter -= 1
# 이벤트 드리븐(Event Driven)... 메인루프상 계속 모니터링이 되어야 한다. 위의 기능이 실행조차 되지 않는다.
# 다른 방법을 써야 한다. >> window.after()
def count_down(count):
count_min = math.floor(count / 60)
if count_min < 10:
count_min = f"0{count_min}"
count_sec = count % 60
if count_sec < 10:
count_sec = f"0{count_sec}"
canvas.itemconfig(timer_text, text=f"{count_min}:{count_sec}")
if count > 0:
window.after(1000, count_down, count -1)
# ---------------------------- UI SETUP ------------------------------- #
window = Tk()
window.title("Pomodoro. 14May2022, kio")
window.config(padx=100, pady=50, bg=YELLOW)
Top_label = Label(text="Timer", fg=GREEN, bg=YELLOW, font=(FONT_NAME, 50, "bold"))
Top_label.grid(column=1, row=0)
canvas = Canvas(width=200, height=224, bg=YELLOW, highlightthickness=0)
tomato_img = PhotoImage(file="tomato.png")
canvas.create_image(100,112,image=tomato_img)
pre = ""
if WORK_MIN < 10:
pre = "0"
timer_text = canvas.create_text(102,128,text=f"{pre}{WORK_MIN}:00", fill="white",font=(FONT_NAME, 26, "bold"))
#canvas.pack()
canvas.grid(column=1, row=1)
start_button = Button(text="Start", command=start_timer, highlightthickness=0)
start_button.grid(column=0 , row=3)
reset_button = Button(text="Reset", highlightthickness=0)
reset_button.grid(column=3 , row=3)
check_mark = Label(text="♡", bg=YELLOW, fg=GREEN, font=(FONT_NAME, 20, "bold"))
check_mark.grid(column=1, row=4)
window.mainloop()
10분 미만, 10초 미만이 표현될때 자리수를 맞췄다.
'Test > Python(20220101~)' 카테고리의 다른 글
Days29. Password manager - 1 (tkinter) (0) | 2022.05.21 |
---|---|
Days28. Timer (최종) (0) | 2022.05.18 |
Days28. Timer 계속 (tkinter) (0) | 2022.05.18 |
Days28. Timer 계속 (tkinter) (0) | 2022.05.14 |
Days28.Canvas 위젯, Tkinter 배경 이미지 (0) | 2022.04.23 |
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- artandculture
- vmware
- sysprep
- virt-sysprep
- vmware.powercli
- 중복제거
- set()
- exadata
- 3par
- 배열
- 차집합
- LIST
- powercli
- cloud-init
- fromkeys
- 변수화
- 읽어오기
- 정렬
- insert
- storage
- 대소문자
- 스토리지
- dp-2
- powershell
- dezoomify
- dp-1
- 부동없이
- Join
- EXA
- oracle
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 |
글 보관함