|
| 1 | +{ |
| 2 | + "cells": [ |
| 3 | + { |
| 4 | + "cell_type": "code", |
| 5 | + "execution_count": 1, |
| 6 | + "metadata": {}, |
| 7 | + "outputs": [ |
| 8 | + { |
| 9 | + "name": "stderr", |
| 10 | + "output_type": "stream", |
| 11 | + "text": [ |
| 12 | + "c:\\Users\\Lenovo\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\pyglet\\image\\codecs\\wic.py:434: UserWarning: [WinError -2147417850] Cannot change thread mode after it is set\n", |
| 13 | + " warnings.warn(str(err))\n" |
| 14 | + ] |
| 15 | + } |
| 16 | + ], |
| 17 | + "source": [ |
| 18 | + "from tkinter import *\n", |
| 19 | + "import tkinter\n", |
| 20 | + "from datetime import datetime\n", |
| 21 | + "import pyglet\n", |
| 22 | + "font=pyglet.font.add_file('digital-7.ttf')\n", |
| 23 | + "\n", |
| 24 | + "\n", |
| 25 | + "cor1 = \"#3d3d3d\" # black\n", |
| 26 | + "cor2 = \"#fafcff\" # white\n", |
| 27 | + "cor3 = \"#21c25c\" # green\n", |
| 28 | + "cor4 = \"#eb463b\" # red\n", |
| 29 | + "cor5 = \"#dedcdc\" # gray\n", |
| 30 | + "cor6 = \"#3080f0\" # blue\n", |
| 31 | + "\n", |
| 32 | + "root = Tk()\n", |
| 33 | + "root.title(\"\")\n", |
| 34 | + "root.geometry('440x180')\n", |
| 35 | + "root.configure(background=cor1)\n", |
| 36 | + "\n", |
| 37 | + "\n", |
| 38 | + "def clock():\n", |
| 39 | + " time = datetime.now()\n", |
| 40 | + " hour = time.strftime(\"%H:%M:%S\")\n", |
| 41 | + " weekday = time.strftime(\"%A\")\n", |
| 42 | + " day = time.day\n", |
| 43 | + " month = time.strftime(\"%b\")\n", |
| 44 | + " year = time.strftime(\"%Y\")\n", |
| 45 | + " l1.config(text=hour)\n", |
| 46 | + " l1.after(200, clock)\n", |
| 47 | + " l2.config(text=weekday + \" \" + str(day) + \"/\" + str(month) + \"/\" + (year))\n", |
| 48 | + "\n", |
| 49 | + "\n", |
| 50 | + "l1 = Label(root, text=\"10:05:05\", font=('digital-7 80'), bg=cor1, fg=cor3)\n", |
| 51 | + "l1.grid(row=0, column=0, sticky=NW, padx=5)\n", |
| 52 | + "\n", |
| 53 | + "l2 = Label(root, font=('digital-7 20'), bg=cor1, fg=cor3)\n", |
| 54 | + "l2.grid(row=1, column=0, sticky=NW, padx=5)\n", |
| 55 | + "\n", |
| 56 | + "clock()\n", |
| 57 | + "\n", |
| 58 | + "root.mainloop()" |
| 59 | + ] |
| 60 | + }, |
| 61 | + { |
| 62 | + "cell_type": "code", |
| 63 | + "execution_count": null, |
| 64 | + "metadata": {}, |
| 65 | + "outputs": [], |
| 66 | + "source": [] |
| 67 | + } |
| 68 | + ], |
| 69 | + "metadata": { |
| 70 | + "interpreter": { |
| 71 | + "hash": "8c3d4d9970fc5c09c50d9318a9c7fbf4d0159e4b28833276f5678ee22bded273" |
| 72 | + }, |
| 73 | + "kernelspec": { |
| 74 | + "display_name": "Python 3.10.4 64-bit", |
| 75 | + "language": "python", |
| 76 | + "name": "python3" |
| 77 | + }, |
| 78 | + "language_info": { |
| 79 | + "codemirror_mode": { |
| 80 | + "name": "ipython", |
| 81 | + "version": 3 |
| 82 | + }, |
| 83 | + "file_extension": ".py", |
| 84 | + "mimetype": "text/x-python", |
| 85 | + "name": "python", |
| 86 | + "nbconvert_exporter": "python", |
| 87 | + "pygments_lexer": "ipython3", |
| 88 | + "version": "3.10.4" |
| 89 | + }, |
| 90 | + "orig_nbformat": 4 |
| 91 | + }, |
| 92 | + "nbformat": 4, |
| 93 | + "nbformat_minor": 2 |
| 94 | +} |
0 commit comments