Create Date & Time Clock using Python in Pycharm or Notepad || Tech Naaj ||
Python is an interpreted, object-oriented, high-level
programming language with dynamic semantics. Its high-level built in data structures, combined with dynamic typing and dynamic binding, make it very attractive for Rapid Application Development, as well as for use as a scripting or glue language to connect existing components together. Python's simple, easy to learn syntax emphasizes readability and therefore reduces the cost of program maintenance. Python supports modules and packages, which encourages program modularity and code reuse.
[Source: https://www.python.org/doc/essays/blurb/]
In this video, I am going to create a Clock which is made using python programming language. It requires a built-in module named tkinter and time to build this Digital Clock.
You can convert it to .exe or any other formats using other modules and tools from pypi.org . So, you are basically building your own Clock app using Python programming language.
Since, most of the people are more concerned with the android applications because of increasing demands of worldwide popular Android platform, We will focus on building more android applications and desktop applications through python or other programming language in this channel through video tutorials in the future. For example, I have used two different (Or you might say 'kinda similar') ways for coding: One from the Pycharm and One from the Notepad where both of them have different codes used. I have not shown what codes were used in the Notepad. But, Yes, they were different. You can check out yourself. Here I will show both the short 17 lines of codes and long ones to build the same Clock application.
The method is quite similar. Just copy-paste the below code in Pycharm or Notepad like shown in the video and then follow video to create Clock. This the 17 lines of code(short):
from tkinter import *
from tkinter.ttk import *
from time import strftime
root = Tk()
root.title("Clock")
def t():
s=strftime('%H:%M:%S %p')
d=strftime('%Y-%h-%d %a')
label1.config(text=d)
label.config(text=s)
label.after(1000, t)
label = Label(root, font="(arial, 70", background ="black", foreground = "lime")
label1 = Label(root, font="(arial, 52", background = "black", foreground = "cyan")
label1.pack(anchor='nw')
label.pack(anchor='center')
t()
root.mainloop()
The above code is the short one. Below is the long code:
from tkinter import *
from tkinter.ttk import *
from time import strftime
root = Tk()
root.title("Clock")
def t():
s=strftime('%H:%M:%S %p')
label.config(text=s)
label.after(1000, t)
label = Label(root, font="(arial, 70", background ="blanchedalmond", foreground = "lime")
label.pack(anchor='center')
t()
def date():
d=strftime('%Y-%h-%d %a')
label1.config(text=d)
label1 = Label(root, font="(arial, 30", background = "white", foreground = "cyan")
label1.pack(anchor='ne')
date()
root.mainloop()
[Note: Both the codes work. But don't copy-paste both the codes at once. Only the first one you copy would work if you do so. You may only copy one of the codes to make it work. I prefer the short ones which is the clock shown in the Video Thumbnail.]
[For your convenience, both the Code starts from "from tkinter import *" and ends with "root.mainloop()"]
Here's a little caution for you (Read it carefully!):
By telling you to simply copy-paste the codes, I am not trying to encourage you to be a Lazy Script-kiddie. I won't recommend you copy-paste such a small amount of codes in pycharm or notepad unless you are unable to do.
So, that's the end of this video. I will be bringing more these kinds of videos in the future. You know: More tutorials, more knowledge, more success. Also don't forget to hit that like and subscribe button and turn on that notification bell to get notified the latest updates from me. If you got any questions or doubts, just leave it in the comment section down below. I will try to answer every comments as possible. See you next time in the next video. Till then, stay safe, stay happy.
Tags:
#python, #pythontutorial, #pythonprogramming, #tkinter, #time, #Date, #clock, #windows7, #programming, #makeclock, #pcclock, #pycharm, #notepad, #using notepad, #application, #app, #apps, #android, #windows, #desktop, #androidapps, #modules, #functions, #technaaj, #pythonproject, #pycharmproject, #pythonupdates, #tutorial, #pythontuts, #digitalclock, #watch, #video, #pycharmproject, #pycharmtut, #notepadtut, #pycharmcommunity, #pycharm2018, #pycharm2018.3.7, #PC, #Jetsbrain, #hd, #hdvideo, #link, #code, #program, #programmes, #NCS, #amazingvideo, #strftime, #mainloop, #variable, #def, #py
Music used:
Want to use this track? Please copy & paste this into your
description:
Song: Jim Yosef - Link [NCS Release]
Music provided by NoCopyrightSounds.
Watch: https://youtu.be/9iHM6X6uUH8
Download/Stream: http://ncs.io/LinkYO
Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Create Date & Time Clock using Python in Pycharm or Notepad || Tech Naaj ||», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.
Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.
Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!
Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.