I made something that moves (wider range)

My feelings

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


Looks difficult

Conclusion: Everything seems difficult.


Duel with yourself

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


Try to find more

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


Arrange the timer

The head family is the last star of the timer, but only letters (Mimicchii)


It's CODE

from time import sleep
print("Characters will appear after 3 seconds.")
sleep(3)
print("It's time")

Description

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.


I tried to move

ezgif.com-video-to-gif (6).gif


not good?

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


Let's evolve more!

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)

Description

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 tried to move

ezgif.com-video-to-gif (7).gif


I'm glad

I'm happy to move


I want to display it on tkinter

I want to put out originality () and I want to display it using tkinter


It's code

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()

result

It was impossible Pien 2020-07-10.png


Consideration & impression

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.


Referenced

Shooting game Breakout How to make a timer The easiest Python introductory class (Sotec, Author: Fumitaka Osawa)

Recommended Posts

I made something that moves (wider range)
I made something with python that NOW LOADING moves from left to right on the terminal
I made an extenum package that extends an enum
I made a VM that runs OpenCV for Python
I made an Android application that displays Google Map
〇✕ I made a game
I made an Ansible-installer
I made my goimports
A story that stumbled when I made a chatbot with Transformer
I made a LINE BOT that returns parrots with Go
I made a class that easily performs unixtime ← → datetime conversion
I made a fucking app that won't let you skip
I made an anomaly detection model that works on iOS
I made a rigid Pomodoro timer that works with CUI
I made a plug-in that can "Daruma-san fell" with Minecraft
I made a neural network generator that runs on FPGA