GUI Calendar using Tkinter in Python
GUI:
A graphical interface (GUI) is a user interface that lets users interact with electronic devices like computers and smartphones by using menus, icons, and other visual cues (graphics). In contrast to text-based interfaces, which only display data and commands as text, GUIs visualize information and related user controls. A cursor, trackball, stylus, or thumb on a touch screen are all pointing devices that can be used to communicate with GUI representations. The first text interface between a human and a computer operated using keyboard input and a prompt.
One of the most significant factors that increased the usability of computer and digital technologies for common, less tech-savvy users is likely the development and widespread adoption of GUIs. GUIs are intuitive enough that even relatively unskilled employees without programming experience can use them. Because they are always designed with the user in mind rather than being primarily machine-centered, they have become the standard in software application programming.
Commands were entered at the DOS prompt to ask for responses from a desktop. These commands' usage and the requirement for precise spelling led to an unwieldy and ineffective user interface.
The user is provided with information using manipulable visual widgets that don't require command-line input. These interface components respond to the user's interactions per the pre-programmed script, assisting each user's action. Since many GUIs represent text and graphical elements in standard formats, it is possible for programs using the same GUI software to share data. As it is patched and developed, the same software application or os version may present distinct or marginally distinct GUIs. The appearance of an application may change depending on user needs or to enhance the user experience, even if the application's core functionality and functions remain unchanged, as was the case with the various Windows versions over time.
Tkinter:
Tkinter bridges the gap between Python's execution model and Tcl's, built around cooperative multitasking. Like Python, Tcl is an interpreted dynamic programming language. Although it is an overall programming language that can be used independently, it is most frequently used in C programs as a scripting motor or as an interaction with the Tk toolbox. The Tcl library has a C interface that enables users to add custom Tcl or C commands, run Tcl commands and scripts, and manage one or more Tcl interpreter instances. Each interpreter has a queue for events that can be used to send and process events.
The standard Python technique for building Graphical User Interfaces (GUIs) is Tkinter, which is included in all popular Python distributions. The only framework included in the Python standard library is this one. On top of Tk, this Python framework serves as a thin object-oriented layer that provides access to the Tk toolkit.
GUI Calendar By Tkinter:
Building projects in Python is exciting. To make projects interactive, Python offers a variety of modules and libraries. One such attribute is the graphical user interface (GUI), which can be added to projects using Modules like Tkinter, PyQt5, Kivy, and more graphical user interface (GUI), which can be added to projects using Modules like Tkinter, PyQt5, Kivy, and more, is one such attribute. One of the most popular libraries for creating interactive GUI applications is the Tkinter library. It is portable and simple to use. This library can be used with various operating systems, including Windows, Linux, and macOS.
CODE:
from tkinter import *
import calendar
def showCal() :
new_gui = Tk()
new_gui.config(background = "white")
new_gui.title("CALENDAR")
new_gui.geometry("550x600")
fetch_year = int(year_field.get())
cal_content = calendar.calendar(fetch_year)
cal_year = Label(new_gui, text = cal_content, font = "Consolas 10 bold")
cal_year.grid(row = 5, column = 1, padx = 20)
new_gui.mainloop()
if __name__ == "__main__" :
gui = Tk()
gui.config(background = "white")
gui.title("CALENDAR")
gui.geometry("250x140")
cal = Label(gui, text = "CALENDAR", bg = "dark gray",
font = ("times", 28, 'bold'))
year = Label(gui, text = "Enter Year", bg = "light green")
year_field = Entry(gui)
Show = Button(gui, text = "Show Calendar", fg = "Black",
bg = "Red", command = showCal)
Exit = Button(gui, text = "Exit", fg = "Black", bg = "Red", command = exit)
cal.grid(row = 1, column = 1)
year.grid(row = 2, column = 1)
year_field.grid(row = 3, column = 1)
Show.grid(row = 4, column = 1)
Exit.grid(row = 6, column = 1)
gui.mainloop()
OUTPUT:
