Something that works ...?
I was told to use Python to make something that works in the assignment, and I thought about it myself, but nothing came to my mind ... Take a look at the past Shooting game Breakout Such
Conclusion: Everything seems difficult.
If you move even a little, it will move. ** But is that so good ** Is it okay not to make a good one by referring to Qiita's text more? A duel took place within me
I found a good one! (I googled for Python beginners) ** How to make a timer ** I'm a beginner, so I can make it! !! (I stopped making great guys with good looks) Make a timer
The head family is the last star of the timer, but only letters (Mimicchii)
from time import sleep
print("Characters will appear after 3 seconds.")
sleep(3)
print("It's time")
I'm using the time module this time ** time module ** is a module that can handle time There are various functions in that module, and this time I used the sleep function. The ** sleep function ** can control the timer, which means that it should stop for 3 seconds this time.
There was a sense of accomplishment (quick) that I could do it myself, so I wanted to do more and refer to the article very much
Look at the code of the article and change the letters and seconds
from time import sleep
target_time = 5
def count_up(secs):
for i in range(0,secs):
print(i)
sleep(1)
print("It's time ★")
count_up(target_time)
def count_up
is a function that counts up time.
The name after def is the name of the function, and you can create your own function.
It prints every second and is written as if counting.
I'm happy to move
I want to put out originality () and I want to display it using tkinter
import tkinter as tk
from time import sleep
target_time = 5
def up_timer(secs):
for i in range(0,secs):
print(i)
sleep(1)
print("It's time ★")
up_timer(target_time)
root = tk.Tk()
root.geometry("400x150")
root.title("timer")
root.mainloop()
canvas =tk.Canvas(root, width =400, height =150, dg="white")
canvas.place(x = 50, y = 50)
canvas.create_text(0, 0, print)
root.mainloop()
It was impossible Pien
I think it's difficult to express sentences with tk_inter ... (maybe lack of thought) Change a little! It's easy to refer to textbooks and online ones, but it was a tough world for me to think and create from scratch and to create functions by myself. However, it was a good opportunity because I had never thought about making it myself, and one day I wanted to make an app.
Shooting game Breakout How to make a timer The easiest Python introductory class (Sotec, Author: Fumitaka Osawa)
Recommended Posts