- 
                Notifications
    You must be signed in to change notification settings 
- Fork 32
Add Digital Clock Project. #25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Merged
      
      
            iamwatchdogs
  merged 6 commits into
  Grow-with-Open-Source:main
from
DarkSlayer102:Digital_Clock
  
      
      
   
  Dec 23, 2024 
      
    
  
     Merged
                    Changes from 3 commits
      Commits
    
    
            Show all changes
          
          
            6 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      6ef7a72
              
                I have included my Digital_Clock into the Python-Projects folder
              
              
                DarkSlayer102 e95c756
              
                Update Digital_Clock/digital_clock.py
              
              
                DarkSlayer102 c6978d4
              
                Update digital_clock.py
              
              
                DarkSlayer102 5a45357
              
                Update Digital_Clock/digital_clock.py
              
              
                DarkSlayer102 4aac33a
              
                Update digital_clock.py
              
              
                DarkSlayer102 e4944c2
              
                Create README.MD
              
              
                DarkSlayer102 File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| import tkinter as tk | ||
| import time | ||
| from tkinter.font import Font | ||
|  | ||
| ''' | ||
| In this project, I have imported all the necessary packages, including time and Tkinter. Tkinter is a built-in library that enables the creation of Graphical User Interfaces (GUIs). | ||
| ''' | ||
|  | ||
|  | ||
| def clocks(): | ||
| ''' | ||
| This function displays the current time. | ||
| ''' | ||
| currentTime = time.gmtime() | ||
| currentTime = f'{currentTime.tm_hour}:{currentTime.tm_min}:{currentTime.tm_sec}' | ||
| clock.config(text=currentTime) | ||
| clock.after(200, clocks) | ||
| ''' | ||
| This is simply printing out to verify whether it is functioning correctly or not. | ||
| ''' | ||
| print("Working Properly") | ||
|         
                  DarkSlayer102 marked this conversation as resolved.
              Outdated
          
            Show resolved
            Hide resolved | ||
|  | ||
|  | ||
| ''' | ||
| Here I created a instance of TK class | ||
| ''' | ||
| window = tk.Tk() | ||
| # creating a title | ||
| window.title("Digital Clock") | ||
| # creating background color | ||
| window.config(bg="black") | ||
|  | ||
| font1 = Font(family="Arial", size=90, weight="normal") | ||
| # creating a header using Label Widget | ||
| header = tk.Label(window, text="Time Clock", font=font1, bg="gray", fg="white") | ||
| # using grid() to place the header somewhere comfortable in the gui | ||
| header.grid(row=1, column=2) | ||
| ''' | ||
| A clock is being constructed using the Label Widget, which exhibits the current time and is positioned using grid. | ||
| ''' | ||
| clock = tk.Label(window, font=("times", 90, "bold"), bg="blue", fg='white') | ||
| clock.grid(row=2, column=2, padx=620, pady=250) | ||
|  | ||
| ''' | ||
|  | ||
| calling the function here | ||
| ''' | ||
| clocks() | ||
|  | ||
| ''' | ||
| running the main window | ||
| ''' | ||
|         
                  DarkSlayer102 marked this conversation as resolved.
              Outdated
          
            Show resolved
            Hide resolved | ||
| if __name__ == "__main__": | ||
|  | ||
| window.mainloop() | ||
|         
                  DarkSlayer102 marked this conversation as resolved.
              Outdated
          
            Show resolved
            Hide resolved | ||
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.