Code Monkey home page Code Monkey logo

ctkclock's Introduction

CTkClock

A Library for CLock widget in Tkinter and CTkinter.

Installation

Since this Library is not yet ready, it's not published yet.
Download the folder and put it inside this directory to use:

c:\users\me\appdata\local\programs\python\python38\lib\site-packages

AnalogCLock

Usage:

Example 1:

from tkinter import *
from CTkClock import *

root = Tk()
root.title('Tkinter example')

clock = AnalogClock(root, radius = 150,)
clock.pack()

root.mainloop()

Example 1

Example 2:

from customtkinter import *
from CTkClock import *

root = CTk()
root.title('Custom Tkinter Example')
set_appearance_mode("dark")

clock = AnalogClock(root, radius = 150, font_color = "white", font=("Fira Code", 15, "bold"),
                    border_width=5, second_hand_width=3, minute_hand_width=5, hour_hand_width=7, 
                    hour_color='white', minute_color='white', start_time='05:15:49')
clock.pack()

root.mainloop()

Example 2

Example 3:

from customtkinter import *
from CTkClock import *

root = CTk()
root.geometry("800x700")
root.title('Custom Tkinter Example')

clock = AnalogClock(root, radius = 160, font_color = "black", font=("Fira Code", 15, "bold"),
                    border_width=5, second_hand_width=4, minute_hand_width=6, hour_hand_width=8, )
clock.place(relx=0.05, rely=0.05,)

clock = AnalogClock(root, radius = 150, font_color = "black", font=("Fira Code", 15, "bold"), border_color='#008000',
                    border_width=5, second_hand_width=4, minute_hand_width=6, hour_hand_width=8,
                    hour_color="red", minute_color="purple", second_color="green", 
                    start_time='03:45:55', shape='rectangle', )
clock.place(relx=0.55, rely=0.05,)

clock = AnalogClock(root, radius = 150, font_color = "black", font=("Fira Code", 15, "bold"),
                    border_width=5, fg_color='#d3d3d3', 
                    quarter_hour=True,)
clock.place(relx=0.05, rely=0.55,)

clock = AnalogClock(root, radius = 150, font_color = "black", font=("Fira Code", 15, "bold"),
                    border_width=5, fg_color='#d3d3d3', 
                    quarter_hour=True, quarter_symbol='*', )
clock.place(relx=0.55, rely=0.55,)

root.mainloop()

Example 3

Arguments:

Parameters Description
master widget or window where the clock will be placed.
radius (int): Radius of the clock in pixels.
shape (str): The shape of the clock face, either 'circle' or 'rectangle'. Default: 'circle'
border_width (int): Width of the clock border.
border_color (str): The color of the border.
clock_face_style (str): The style of clock face. Either 'Digit' or 'Roman' or 'Tick' or 'NONE'. Default: 'digit'
fg_color (str): The foreground color of the clock face or 'transparent' to match the parent's background. Default: 'transparent'
bg_color (str): The background color of the clock face or 'transparent' to match the parent's background. Default: 'transparent'
font (Tuple[str, int, str]): Font specifications for the clock numbers.
font_color (str): The color of the clock numbers.
hour_color (str): The color of the hour hand.
minute_color (str): The color of the minute hand.
second_color (str): The color of the second hand.
hour_hand_width (int): The width of the hour hand.
minute_hand_width (int): The width of the minute hand.
second_hand_width (int): The width of the second hand.
start_time (Optional[str]): The initial time in the format 'HH:MM:SS'.
quarter_hour (bool): If True, display only 3, 6, 9, 12 and optional quarter symbols.
quarter_symbol (Optional[str]): Symbol to be displayed instead of numbers not divisible by 3.
quarter_symbol_color (Optional[str]): Color of the quarter symbols.

Methods:

Methods Description
.get_current_time() Get the current time of the clock as a datetime object.
.get_current_strftime(format_string="%H:%M:%S") Get the current time of the clock as a formatted string.
.configure() To configure some options of the clock.

ctkclock's People

Contributors

arthur-101 avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.