

{"id":80297,"date":"2020-08-06T14:16:09","date_gmt":"2020-08-06T08:46:09","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=80297"},"modified":"2021-03-08T18:25:14","modified_gmt":"2021-03-08T12:55:14","slug":"library-management-system-python-project","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/library-management-system-python-project\/","title":{"rendered":"Library Management System &#8211; Python Project with Source Code"},"content":{"rendered":"<div class='__iawmlf-post-loop-links' style='display:none;' data-iawmlf-post-links='[{&quot;id&quot;:1029,&quot;href&quot;:&quot;https:\\\/\\\/www.mysql.com\\\/downloads&quot;,&quot;archived_href&quot;:&quot;http:\\\/\\\/web-wp.archive.org\\\/web\\\/20251002193459\\\/https:\\\/\\\/www.mysql.com\\\/downloads\\\/&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2025-12-08 21:24:36&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2025-12-12 01:05:07&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2025-12-15 02:18:25&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2025-12-18 03:19:39&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2025-12-21 04:34:47&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2025-12-24 12:54:30&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2025-12-28 06:50:18&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2025-12-31 14:07:27&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-01-03 20:14:09&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-01-07 03:27:40&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-01-10 04:02:05&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-01-13 05:59:59&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-01-16 08:24:07&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-01-19 08:28:26&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-01-22 10:52:36&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-01-25 11:10:23&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-01-28 13:30:13&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-01-31 13:34:19&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-02-03 14:22:08&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-02-06 15:55:24&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-02-09 16:50:32&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-02-13 00:40:29&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-02-16 05:03:32&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-02-19 05:04:10&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-02-22 12:06:44&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-02-25 17:36:16&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-02-28 17:42:11&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-04 03:55:40&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-07 04:31:45&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-10 09:35:34&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-13 09:38:56&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-16 10:08:57&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-19 12:47:30&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-22 13:20:16&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-25 23:28:27&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-29 06:58:50&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-01 09:18:49&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-04 22:25:13&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-08 02:53:17&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-11 10:32:20&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-14 10:56:56&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-17 11:24:14&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-20 14:20:29&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-23 15:22:10&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-26 22:29:38&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-30 06:15:32&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-05-03 07:13:44&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-05-06 10:58:06&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-05-10 09:40:10&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-05-13 15:10:13&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-05-16 15:25:33&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-05-19 19:26:59&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-05-23 00:40:39&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-05-26 08:39:11&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-05-29 09:53:31&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-06-01 09:59:42&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-06-04 11:37:18&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-06-07 11:57:50&quot;,&quot;http_code&quot;:403}],&quot;broken&quot;:true,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-06-07 11:57:50&quot;,&quot;http_code&quot;:403},&quot;process&quot;:&quot;done&quot;}]'><\/div>\n<p><strong>Work on one of the most popular python projects &#8211; Library Management System<\/strong><\/p>\n<p>A library management system keeps track of the books present in the library. It is an important piece of software which is a must at schools and colleges. We will build a library management system using Tkinter to make it interactive.<\/p>\n<h3>What is Tkinter?<\/h3>\n<p>Python offers various utilities to design the GUI wiz Graphical User Interface, and one such utility is Tkinter which is most commonly used. It is indeed one of the fastest and easiest ways to build GUI applications. Moreover, Tkinter is cross-platform, hence the same code works on macOS, Windows, and Linux.<\/p>\n<h2>Library Management System in Python<\/h2>\n<p>The library management system in python which we are going to build will look something like this<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/library-management-system-python.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-80329\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/library-management-system-python.png\" alt=\"library management system python\" width=\"751\" height=\"665\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/library-management-system-python.png 751w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/library-management-system-python-300x266.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/library-management-system-python-150x133.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/library-management-system-python-520x460.png 520w\" sizes=\"auto, (max-width: 751px) 100vw, 751px\" \/><\/a><\/p>\n<p>Yes, this is the library management project which we are going to build. I know this may be a long article but be with me as at the end of the article you will be equipped with the knowledge to design and build great applications with decent UI.<\/p>\n<p>Let\u2019s begin!<\/p>\n<h3>Project Prerequisites<\/h3>\n<p><strong>tkinter &#8211; <\/strong>Please run below command to install tkinter<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">pip install tkinter\r\n<\/pre>\n<p><strong>pillow &#8211;<\/strong> Please run below command to install tkinter<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">pip install pillow\r\n<\/pre>\n<p><strong>pymysql &#8211;<\/strong> Please run below command to install tkinter<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">pip install pymysql\r\n<\/pre>\n<p><em><strong>Note:<\/strong><\/em> You are required to have MySQL server installed on your system in order to make pymysql work. If you do not have it ready, please download from <a href=\"https:\/\/www.mysql.com\/downloads\/\">MySQL Official website<\/a><\/p>\n<h3>Download Project Code<\/h3>\n<p>Before proceeding ahead, please download the library project source code: <a href=\"https:\/\/data-flair.training\/blogs\/download-library-management-project-source-code\/\"><strong>Library Management System in Python<\/strong><\/a><\/p>\n<h3>Description of Project Files<\/h3>\n<p>Below are the project files you will get once you download and extract the Library project:<\/p>\n<ul>\n<li><strong>main.py<\/strong> \u2013 which does function call to all other python files<\/li>\n<li><strong>AddBook.py<\/strong> \u2013 To add the book<\/li>\n<li><strong>ViewBooks.py<\/strong> \u2013 To View the list of books in the library<\/li>\n<li><strong>DeleteBook.py<\/strong> \u2013 To Delete a book from library<\/li>\n<li><strong>IssueBook.py<\/strong> \u2013 To Issue a book from library<\/li>\n<li><strong>ReturnBook.py<\/strong> \u2013 To Return a book to the library<\/li>\n<\/ul>\n<h3>Description of Tables<\/h3>\n<h4>Create Tables<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">create database db;\r\n\r\ncreate table books(bid varchar(20) primary key, title varchar(30), author varchar(30), status varchar(30));\r\n\r\ncreate table books_issued(bid varchar(20) primary key, issuedto varchar(30));\r\n<\/pre>\n<p><strong>1. books<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/new-books-table.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-80341\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/new-books-table.png\" alt=\"new books table\" width=\"1350\" height=\"436\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/new-books-table.png 1350w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/new-books-table-300x97.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/new-books-table-1024x331.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/new-books-table-150x48.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/new-books-table-768x248.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/new-books-table-520x168.png 520w\" sizes=\"auto, (max-width: 1350px) 100vw, 1350px\" \/><\/a><\/p>\n<p><strong>2. issued_books<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/new-books-issued-table.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-80342\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/new-books-issued-table.png\" alt=\"new books issued table\" width=\"1350\" height=\"408\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/new-books-issued-table.png 1350w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/new-books-issued-table-300x91.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/new-books-issued-table-1024x309.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/new-books-issued-table-150x45.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/new-books-issued-table-768x232.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/new-books-issued-table-520x157.png 520w\" sizes=\"auto, (max-width: 1350px) 100vw, 1350px\" \/><\/a><\/p>\n<h3>Library Management Project Code<\/h3>\n<p>Let&#8217;s start the detailed discussion of each and every file of our library management system python project:<\/p>\n<h4>1. main.py<\/h4>\n<p><strong>1.1. Importing the Modules<\/strong><\/p>\n<p>To use the Tkinter we need to import the Tkinter module. As stated above, we have imported each file so that we can make function calls from our main file.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">from tkinter import *\r\nfrom PIL import ImageTk,Image #PIL -&gt; Pillow\r\nimport pymysql\r\nfrom tkinter import messagebox\r\nfrom AddBook import *\r\nfrom DeleteBook import *\r\nfrom ViewBooks import *\r\nfrom IssueBook import *\r\n<\/pre>\n<p><strong>1.2. Connecting to the MySql server<\/strong><\/p>\n<p>Now we will connect to the server with the correct credentials associated with the MySql server installed on our system.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">mypass = \"root\" #use your own password\r\nmydatabase=\"db\" #The database name\r\n\r\ncon = pymysql.connect (host=\"localhost\",user=\"root\",password=mypass,database=mydatabase)\r\n#root is the username here\r\n\r\ncur = con.cursor() #cur -&gt; cursor\r\n<\/pre>\n<p><strong>1.3. Designing the Window<\/strong><\/p>\n<p>Now we will design the project window and add a background image. Make sure to keep the image in the same directory as the project is in order to avoid discrepancies.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">root = Tk()\r\nroot.title(\"Library\")\r\nroot.minsize(width=400,height=400)\r\nroot.geometry(\"600x500\")\r\n<\/pre>\n<p><strong>Explanation:<\/strong><\/p>\n<p>The above code sets the title of the library project window as &#8216;Library&#8217;. When you run the above code, you will get a window.<\/p>\n<p><strong>Output:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/library-plain-window.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-80334\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/library-plain-window.png\" alt=\"library plain window\" width=\"751\" height=\"665\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/library-plain-window.png 751w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/library-plain-window-300x266.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/library-plain-window-150x133.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/library-plain-window-520x460.png 520w\" sizes=\"auto, (max-width: 751px) 100vw, 751px\" \/><\/a><\/p>\n<p><strong>1.4. Adding a Background Image<\/strong><\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">same=True\r\nn=0.25\r\n\r\n# Adding a background image\r\nbackground_image =Image.open(\"lib.jpg\")\r\n[imageSizeWidth, imageSizeHeight] = background_image.size\r\n\r\nnewImageSizeWidth = int(imageSizeWidth*n)\r\nif same:\r\n    newImageSizeHeight = int(imageSizeHeight*n) \r\nelse:\r\n    newImageSizeHeight = int(imageSizeHeight\/n) \r\n    \r\nbackground_image = background_image.resize((newImageSizeWidth,newImageSizeHeight),Image.ANTIALIAS)\r\nimg = ImageTk.PhotoImage(background_image)\r\nCanvas1 = Canvas(root)\r\nCanvas1.create_image(300,340,image = img)      \r\nCanvas1.config(bg=\"white\",width = newImageSizeWidth, height = newImageSizeHeight)\r\nCanvas1.pack(expand=True,fill=BOTH)\r\n<\/pre>\n<p><strong>Explanation:<\/strong><\/p>\n<p>We store our image in <strong>background_image<\/strong> with the help of <strong>.open()<\/strong> method. We fetch the image dimensions and adjust the image size according to our window size.<\/p>\n<p><strong>newImageHeight<\/strong> and <strong>newImageWidth<\/strong> contains the adjusted image dimensions.<\/p>\n<p>Now we resize the image using <strong>.resize()<\/strong> method using the new dimensions.<\/p>\n<p>The <strong>.PhotoImage()<\/strong> method is used to display images (either grayscale or true color images) in labels, buttons, canvases, and text widgets.<\/p>\n<p>We create the image on the <strong>canvas1<\/strong> using <strong>.create_image()<\/strong> method. We use <strong>.pack()<\/strong> method to organize widgets in blocks before placing them in the parent widget.<\/p>\n<p><strong>1.5. Setting up the Head Frame<\/strong><\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">headingFrame1 = Frame(root,bg=\"#FFBB00\",bd=5)\r\nheadingFrame1.place(relx=0.2,rely=0.1,relwidth=0.6,relheight=0.16)\r\nheadingLabel = Label(headingFrame1, text=\"Welcome to \\n DataFlair Library\", bg='black', fg='white', font=('Courier',15))\r\nheadingLabel.place(relx=0,rely=0, relwidth=1, relheight=1)\r\n<\/pre>\n<p><strong>Explanation:<\/strong><\/p>\n<p>We create a frame that will hold our Label wiz <strong>headingLabel<\/strong>. We increase the size and alter the font by passing one more parameter in the <strong>Label<\/strong> method wiz <strong>font<\/strong>.<\/p>\n<p><strong>1.6. Adding the Buttons<\/strong><\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">btn1 = Button(root,text=\"Add Book Details\",bg='black', fg='white', command=addBook)\r\nbtn1.place(relx=0.28,rely=0.4, relwidth=0.45,relheight=0.1)\r\n    \r\nbtn2 = Button(root,text=\"Delete Book\",bg='black', fg='white', command=delete)\r\nbtn2.place(relx=0.28,rely=0.5, relwidth=0.45,relheight=0.1)\r\n    \r\nbtn3 = Button(root,text=\"View Book List\",bg='black', fg='white', command=View)\r\nbtn3.place(relx=0.28,rely=0.6, relwidth=0.45,relheight=0.1)\r\n    \r\nbtn4 = Button(root,text=\"Issue Book to Student\",bg='black', fg='white', command = issueBook)\r\nbtn4.place(relx=0.28,rely=0.7, relwidth=0.45,relheight=0.1)\r\n    \r\nbtn5 = Button(root,text=\"Return Book\",bg='black', fg='white', command = returnBook)\r\nbtn5.place(relx=0.28,rely=0.8, relwidth=0.45,relheight=0.1)\r\nroot.mainloop()\r\n<\/pre>\n<p><strong>Explanation:<\/strong><\/p>\n<p>The above code adds buttons to the window frame.<\/p>\n<p><strong>AddBook Details :<\/strong><\/p>\n<p>btn1 stores the button created on <strong>root<\/strong> with <strong>text = \u2018AddBook Details\u2019<\/strong>. As soon as someone clicks this button, we call the function addBook defined in the <strong>AddBook.py<\/strong>. We call a function by specifying the <strong>command<\/strong> parameter equal to the <strong>name of the function<\/strong>.<\/p>\n<p>We place this button using the <strong>.place()<\/strong> method by defining the position as well as dimensions of the button.<\/p>\n<p>Similarly, we define other buttons using the <strong>Button<\/strong> method and keep placing them by making minor changes in the <strong>rely<\/strong> parameter. You can notice that we are increasing it by 0.1 every time we define a new button.<\/p>\n<p><strong>Output:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/library-management-system-python.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-80329\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/library-management-system-python.png\" alt=\"library management system python\" width=\"751\" height=\"665\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/library-management-system-python.png 751w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/library-management-system-python-300x266.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/library-management-system-python-150x133.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/library-management-system-python-520x460.png 520w\" sizes=\"auto, (max-width: 751px) 100vw, 751px\" \/><\/a><\/p>\n<h4>2. AddBook.py<\/h4>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/library-add-book.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-80335\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/library-add-book.png\" alt=\"library add book\" width=\"752\" height=\"665\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/library-add-book.png 752w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/library-add-book-300x265.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/library-add-book-150x133.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/library-add-book-520x460.png 520w\" sizes=\"auto, (max-width: 752px) 100vw, 752px\" \/><\/a><\/p>\n<p><strong>2.1. Importing the necessary modules<\/strong><\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">from tkinter import *\r\nfrom PIL import ImageTk,Image\r\nfrom tkinter import messagebox\r\nimport pymysql\r\n<\/pre>\n<p><strong>2.2. Function &#8211; bookRegister()<\/strong><\/p>\n<p>This function executes an SQL command to insert data into the table and commit the changes.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">def bookRegister():\r\n    \r\n    bid = bookInfo1.get()\r\n    title = bookInfo2.get()\r\n    author = bookInfo3.get()\r\n    status = bookInfo4.get()\r\n    status = status.lower()\r\n    \r\n    insertBooks = \"insert into \"+bookTable+\" values ('\"+bid+\"','\"+title+\"','\"+author+\"','\"+status+\"')\"\r\n    try:\r\n        cur.execute(insertBooks)\r\n        con.commit()\r\n        messagebox.showinfo('Success',\"Book added successfully\")\r\n    except:\r\n        messagebox.showinfo(\"Error\",\"Can't add data into Database\")\r\n    \r\n    print(bid)\r\n    print(title)\r\n    print(author)\r\n    print(status)\r\n    root.destroy()\r\n\r\n<\/pre>\n<p><strong>Explanation:<\/strong><\/p>\n<p>We fetch the data in the input field by <strong>.get()<\/strong> method. Hence after fetching each of the data fields value we are ready to execute an SQL command to insert the data.<\/p>\n<p><strong>General Syntax:<\/strong><\/p>\n<p>insert into &lt;Table Name&gt; values (&lt;the values of the respective columns&gt;)<\/p>\n<p><strong>Modified :<\/strong><\/p>\n<p>insertBooks = &#8220;insert into &#8220;+bookTable+&#8221; values (&#8216;&#8221;+bid+&#8221;&#8216;,'&#8221;+title+&#8221;&#8216;,'&#8221;+author+&#8221;&#8216;,'&#8221;+status+&#8221;&#8216;)&#8221;<\/p>\n<p><em>Note : Please make sure to keep a single apostrophe (\u2018) before and after every variable while writing the query. This ensures it is treated as a string.<\/em><\/p>\n<p>We put this code in a try-except block in order to handle the situation effectively.<\/p>\n<p>Now, we execute the <strong>insertBooks<\/strong> command by <strong>.execute()<\/strong> method associated with cur. We commit the changes by <strong>.commit()<\/strong> method associated with con as discussed above.<\/p>\n<p>We use <strong>messagebox()<\/strong> function to acknowledge the user of success or failure.<\/p>\n<p><strong>2.3. Function &#8211; addBook()<\/strong><\/p>\n<p>This function connects to the MySql server and creates a window for accommodating new text fields. We fetch details of a new book from the user and then call <strong>bookRegister()<\/strong> function to register the books into the table.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">def addBook(): \r\n    \r\n    global bookInfo1 ,bookInfo2, bookInfo3, bookInfo4, Canvas1, con, cur, bookTable, root\r\n    \r\n    root = Tk()\r\n    root.title(\"Library\")\r\n    root.minsize(width=400,height=400)\r\n    root.geometry(\"600x500\")\r\n\r\n\r\n    mypass = \"root\"\r\n    mydatabase=\"db\"\r\n\r\n    con = pymysql.connect( host=\"localhost\",user=\"root\",password=mypass,database=mydatabase)\r\n    cur = con.cursor()\r\n\r\n    # Enter Table Names here\r\n    bookTable = \"books\" # Book Table\r\n\r\n    Canvas1 = Canvas(root)\r\n    \r\n    Canvas1.config(bg=\"#ff6e40\")\r\n    Canvas1.pack(expand=True,fill=BOTH)\r\n        \r\n    headingFrame1 = Frame(root,bg=\"#FFBB00\",bd=5)\r\n    headingFrame1.place(relx=0.25,rely=0.1,relwidth=0.5,relheight=0.13)\r\n\r\n    headingLabel = Label(headingFrame1, text=\"Add Books\", bg='black', fg='white', font=('Courier',15))\r\n    headingLabel.place(relx=0,rely=0, relwidth=1, relheight=1)\r\n\r\n\r\n    labelFrame = Frame(root,bg='black')\r\n    labelFrame.place(relx=0.1,rely=0.4,relwidth=0.8,relheight=0.4)\r\n        \r\n    # Book ID\r\n    lb1 = Label(labelFrame,text=\"Book ID : \", bg='black', fg='white')\r\n    lb1.place(relx=0.05,rely=0.2, relheight=0.08)\r\n        \r\n    bookInfo1 = Entry(labelFrame)\r\n    bookInfo1.place(relx=0.3,rely=0.2, relwidth=0.62, relheight=0.08)\r\n        \r\n    # Title\r\n    lb2 = Label(labelFrame,text=\"Title : \", bg='black', fg='white')\r\n    lb2.place(relx=0.05,rely=0.35, relheight=0.08)\r\n        \r\n    bookInfo2 = Entry(labelFrame)\r\n    bookInfo2.place(relx=0.3,rely=0.35, relwidth=0.62, relheight=0.08)\r\n        \r\n    # Book Author\r\n    lb3 = Label(labelFrame,text=\"Author : \", bg='black', fg='white')\r\n    lb3.place(relx=0.05,rely=0.50, relheight=0.08)\r\n        \r\n    bookInfo3 = Entry(labelFrame)\r\n    bookInfo3.place(relx=0.3,rely=0.50, relwidth=0.62, relheight=0.08)\r\n        \r\n    # Book Status\r\n    lb4 = Label(labelFrame,text=\"Status(Avail\/issued) : \", bg='black', fg='white')\r\n    lb4.place(relx=0.05,rely=0.65, relheight=0.08)\r\n        \r\n    bookInfo4 = Entry(labelFrame)\r\n    bookInfo4.place(relx=0.3,rely=0.65, relwidth=0.62, relheight=0.08)\r\n        \r\n    #Submit Button\r\n    SubmitBtn = Button(root,text=\"SUBMIT\",bg='#d1ccc0', fg='black',command=bookRegister)\r\n    SubmitBtn.place(relx=0.28,rely=0.9, relwidth=0.18,relheight=0.08)\r\n    \r\n    quitBtn = Button(root,text=\"Quit\",bg='#f7f1e3', fg='black',       command=root.destroy)\r\n    quitBtn.place(relx=0.53,rely=0.9, relwidth=0.18,relheight=0.08)\r\n    \r\n    root.mainloop()\r\n\r\n<\/pre>\n<p><strong>Variables<\/strong><\/p>\n<ul>\n<li><strong>bookInfo1<\/strong> &#8211; contains book ID<\/li>\n<li><strong>bookInfo2<\/strong> &#8211; contains Title of the book<\/li>\n<li><strong>bookInfo3<\/strong> &#8211; contains Author of the book<\/li>\n<li><strong>bookInfo4<\/strong> &#8211; contains status of the book (available or issued)<\/li>\n<li><strong>Con<\/strong> &#8211; MySql console<\/li>\n<li><strong>Cur<\/strong> &#8211; cursor of the console<\/li>\n<\/ul>\n<p><strong>Buttons<\/strong><\/p>\n<ul>\n<li><strong>Submit<\/strong> &#8211; to commit the changes<\/li>\n<li><strong>Exit<\/strong><\/li>\n<\/ul>\n<p><strong>Explanation:<\/strong><\/p>\n<p>We declare certain variables as global in order to use them in the <strong>bookRegister()<\/strong> function.<\/p>\n<p>We create another window and connect to the MySql server and pass on the cursor control to <strong>cur<\/strong>. It means that whatever we want to write on the MySql shell, we will do it through <strong>cur<\/strong>. In order to <strong>commit(write changes in the table)<\/strong> the changes we will use <strong>con<\/strong>.<\/p>\n<p>We draw the canvas and paint it with a good color. I have used <strong>Orange<\/strong>, you can use any color you like.<\/p>\n<p>We create and place the <strong>headingLabel<\/strong> inside the <strong>headingFrame1<\/strong> and give the title as \u201c<strong>Add Books<\/strong>\u201d.<\/p>\n<p>The <strong>labelFrame<\/strong> basically creates a <strong>black box<\/strong> (in our case) to accommodate the input fields to fetch the book details.<\/p>\n<p>We create and place a <strong>Label<\/strong> on our black box which displays the text \u2018<strong>Book ID<\/strong>:\u2019. Just after <strong>Label<\/strong> is placed we create and place the <strong>Entry<\/strong> box acting as our input field.<\/p>\n<p>Similarly, we create and place input fields associated with labels: Title, Author, and Status.<\/p>\n<p>In the end, we create a button to <strong>Finally.!!<\/strong> submit the details given by the user and a button to exit just in case the user did not intend to enter any details in library management.<\/p>\n<p>As an action of a click on the <strong>SubmitBtn<\/strong>, we call the <strong>bookRegister()<\/strong> function to insert the details into the <strong>books<\/strong> table.<\/p>\n<h4>3. ViewBooks.py<\/h4>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/library-view-books.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-80336\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/library-view-books.png\" alt=\"library view books\" width=\"752\" height=\"665\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/library-view-books.png 752w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/library-view-books-300x265.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/library-view-books-150x133.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/library-view-books-520x460.png 520w\" sizes=\"auto, (max-width: 752px) 100vw, 752px\" \/><\/a><\/p>\n<p><strong>3.1. Importing the necessary modules<\/strong><\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">from tkinter import *\r\nfrom PIL import ImageTk,Image\r\nfrom tkinter import messagebox\r\nimport pymysql\r\n<\/pre>\n<p><strong>3.2. Connection to MySql server<\/strong><\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">mypass = \"root\"\r\nmydatabase=\"db\"\r\n\r\ncon = pymysql.connect( host=\"localhost\",user=\"root\",password=mypass,database=mydatabase)\r\ncur = con.cursor()\r\n\r\n# Enter Table Names here\r\nbookTable = \"books\" \r\n<\/pre>\n<p><strong>3.3. Function &#8211; View()<\/strong><\/p>\n<p>This function in our library project creates a window for displaying the records in the table.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">def View(): \r\n    \r\n    root = Tk()\r\n    root.title(\"Library\")\r\n    root.minsize(width=400,height=400)\r\n    root.geometry(\"600x500\")\r\n\r\n    Canvas1 = Canvas(root) \r\n    Canvas1.config(bg=\"#12a4d9\")\r\n    Canvas1.pack(expand=True,fill=BOTH)\r\n\r\n    headingFrame1 = Frame(root,bg=\"#FFBB00\",bd=5)\r\n    headingFrame1.place(relx=0.25,rely=0.1,relwidth=0.5,relheight=0.13)\r\n\r\n    headingLabel = Label(headingFrame1, text=\"View Books\", bg='black', fg='white', font = ('Courier',15))\r\n\r\n    headingLabel.place(relx=0,rely=0, relwidth=1, relheight=1)\r\n\r\n    labelFrame = Frame(root,bg='black')\r\n    labelFrame.place(relx=0.1,rely=0.3,relwidth=0.8,relheight=0.5)\r\n    y = 0.25\r\n\r\n    Label(labelFrame, text=\"%-10s%-40s%-30s%-20s\"%('BID','Title','Author','Status'),\r\n    bg='black',fg='white').place(relx=0.07,rely=0.1)\r\n    Label(labelFrame, text = \"----------------------------------------------------------------------------\",bg='black',fg='white').place (relx=0.05,rely=0.2)\r\n    getBooks = \"select * from \"+bookTable\r\n    try:\r\n        cur.execute(getBooks)\r\n        con.commit()\r\n\r\n\r\n        for i in cur:\r\n            Label(labelFrame,text=\"%-10s%-30s%-30s%-20s\"%(i[0],i[1],i[2],i[3]) ,bg='black', fg='white').place(relx=0.07,rely=y)\r\n            y += 0.1\r\n    except:\r\n        messagebox.showinfo(\"Failed to fetch files from database\")\r\n    \r\n    quitBtn = Button(root,text=\"Quit\",bg='#f7f1e3', fg='black', command=root.destroy)\r\n    quitBtn.place(relx=0.4,rely=0.9, relwidth=0.18,relheight=0.08)\r\n    \r\n    root.mainloop()\r\n\r\n<\/pre>\n<p><strong>Explanation:<\/strong><\/p>\n<p>We create a new window to display the list of books and their status.<\/p>\n<p>Just like we did in the previous file, we create a <strong>headingFrame<\/strong> and title it with a Label to display \u2018<strong>View Books<\/strong>\u2019.<\/p>\n<p>Again we create a black box to accommodate the records returned by the <strong>getBooks<\/strong> query.<\/p>\n<p>We manually display the name of the columns associated with our books table.<\/p>\n<p>We execute the query stored in <strong>getBooks<\/strong> using <strong>cur.execute()<\/strong> display each record one by one as a Label. We place each <strong>Label<\/strong> You can notice that each time a record is displayed the value of <strong>y<\/strong> increases by <strong>\u20180.1\u2019<\/strong>.<\/p>\n<p>In order to handle any discrepancies, we place this code in a try-except block.<\/p>\n<p>In the end, we create and place a button, <strong>quitBtn<\/strong> to exit from the current window of the library project.<\/p>\n<h4>4. DeleteBook.py<\/h4>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/library-delete-book.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-80337\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/library-delete-book.png\" alt=\"library delete book\" width=\"751\" height=\"665\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/library-delete-book.png 751w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/library-delete-book-300x266.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/library-delete-book-150x133.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/library-delete-book-520x460.png 520w\" sizes=\"auto, (max-width: 751px) 100vw, 751px\" \/><\/a><\/p>\n<p><strong>4.1. Importing the necessary modules<\/strong><\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">from tkinter import *\r\nfrom PIL import ImageTk,Image\r\nfrom tkinter import messagebox\r\nimport pymysql\r\n<\/pre>\n<p><strong>4.2. Connect to MySql Server<\/strong><\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">mypass = \"root\"\r\nmydatabase=\"db\"\r\n\r\ncon = pymysql.connect (host=\"localhost\",user=\"root\",password=mypass,database=mydatabase)\r\ncur = con.cursor()\r\n\r\n# Enter Table Names here\r\nissueTable = \"books_issued\" \r\nbookTable = \"books\" #Book Table\r\n\r\n<\/pre>\n<p><strong>4.3. Function &#8211; deleteBook()<\/strong><\/p>\n<p>This function primarily checks if the bid (book id) exists in the book table and if it does, it executes the necessary command to remove it.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">def deleteBook():\r\n    \r\n    bid = bookInfo1.get()\r\n    \r\n    deleteSql = \"delete from \"+bookTable+\" where bid = '\"+bid+\"'\"\r\n    deleteIssue = \"delete from \"+issueTable+\" where bid = '\"+bid+\"'\"\r\n\r\n    try:\r\n        cur.execute(deleteSql)\r\n        con.commit()\r\n        cur.execute(deleteIssue)\r\n        con.commit()\r\n\r\n        messagebox.showinfo('Success',\"Book Record Deleted Successfully\")\r\n\r\n    except:\r\n        messagebox.showinfo(\"Please check Book ID\")\r\n    \r\n    print(bid)\r\n\r\n    bookInfo1.delete(0, END)\r\n    root.destroy()\r\n\r\n<\/pre>\n<p><strong>Explanation:<\/strong><\/p>\n<p>We store the SQL query to delete the record in <strong>deleteSql<\/strong>. After that, we execute this command using <strong>cur.execute()<\/strong>.<\/p>\n<p>In case someone loses a book, we should delete that book from the <strong>issueTable<\/strong> in order to prevent discrepancies in the future. Hence we store the SQl query to delete the same record from the IssueTable in <strong>deleteIssue<\/strong>. We execute it along with the <strong>deleteSql<\/strong>.<\/p>\n<p><strong>4.4. Function &#8211; delete()<\/strong><\/p>\n<p>This function creates a window for accommodating a text input field. We fetch details of a book from the user and then call <strong>deleteBook()<\/strong> function to delete the book record from the table.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">def delete(): \r\n    \r\n    global bookInfo1,bookInfo2,bookInfo3,bookInfo4,Canvas1,con,cur,bookTable,root\r\n    \r\n    root = Tk()\r\n    root.title(\"Library\")\r\n    root.minsize(width=400,height=400)\r\n    root.geometry(\"600x500\")\r\n\r\n\r\n    Canvas1 = Canvas(root)\r\n    Canvas1.config(bg=\"#006B38\")\r\n    Canvas1.pack(expand=True,fill=BOTH)\r\n        \r\n    headingFrame1 = Frame(root,bg=\"#FFBB00\",bd=5)\r\n    headingFrame1.place(relx=0.25,rely=0.1,relwidth=0.5,relheight=0.13)\r\n        \r\n    headingLabel = Label(headingFrame1, text=\"Delete Book\", bg='black', fg='white', font=('Courier',15))\r\n    headingLabel.place(relx=0,rely=0, relwidth=1, relheight=1)\r\n    \r\n    labelFrame = Frame(root,bg='black')\r\n    labelFrame.place(relx=0.1,rely=0.3,relwidth=0.8,relheight=0.5)   \r\n        \r\n    # Book ID to Delete\r\n    lb2 = Label(labelFrame,text=\"Book ID : \", bg='black', fg='white')\r\n    lb2.place(relx=0.05,rely=0.5)\r\n        \r\n    bookInfo1 = Entry(labelFrame)\r\n    bookInfo1.place(relx=0.3,rely=0.5, relwidth=0.62)\r\n    \r\n    #Submit Button\r\n    SubmitBtn = Button(root,text=\"SUBMIT\",bg='#d1ccc0', fg='black',command=deleteBook)\r\n    SubmitBtn.place(relx=0.28,rely=0.9, relwidth=0.18,relheight=0.08)\r\n    \r\n    quitBtn = Button(root,text=\"Quit\",bg='#f7f1e3', fg='black', command=root.destroy)\r\n    quitBtn.place(relx=0.53,rely=0.9, relwidth=0.18,relheight=0.08)\r\n    \r\n    root.mainloop()\r\n\r\n<\/pre>\n<p><strong>Explanation:<\/strong><\/p>\n<p>Firstly, we create a new window and accommodate a <strong>headingFrame<\/strong> followed by creating the <strong>labelFrame<\/strong> to create and place a big black box.<\/p>\n<p>This black box accommodates a <strong>Label<\/strong> and an <strong>Entry<\/strong> text field to take input of the Book ID.<\/p>\n<p>After the black box, we create and place a <strong>Submit<\/strong> and <strong>Quit<\/strong> button associated with the name SubmitBtn and <strong>quitBtn<\/strong> respectively. A click on the Submit button triggers the <strong>deleteBook()<\/strong> function.<\/p>\n<p>Moreover, we declare some variables as <strong>global<\/strong>, in order to provide their access in the <strong>deleteBook()<\/strong> function.<\/p>\n<h4>5. IssueBook.py<\/h4>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/issue-book.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-80338\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/issue-book.png\" alt=\"issue book\" width=\"752\" height=\"665\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/issue-book.png 752w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/issue-book-300x265.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/issue-book-150x133.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/issue-book-520x460.png 520w\" sizes=\"auto, (max-width: 752px) 100vw, 752px\" \/><\/a><\/p>\n<p><strong>5.1. Importing the necessary modules<\/strong><\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">from tkinter import *\r\nfrom PIL import ImageTk,Image\r\nfrom tkinter import messagebox\r\nimport pymysql\r\n<\/pre>\n<p><strong>5.2. Connecting to the MySql server<\/strong><\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">mypass = \"root\"\r\nmydatabase=\"db\"\r\n\r\ncon = pymysql.connect(host=\"localhost\",user=\"root\", password=mypass,database=mydatabase)\r\ncur = con.cursor()\r\n\r\n\r\n# Enter Table Names here\r\nissueTable = \"books_issued\" \r\nbookTable = \"books\"\r\n\r\nallBid = []  #To store all the Book ID\u2019s\r\n<\/pre>\n<p><strong>5.3. Function &#8211; issue()<\/strong><\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">def issue():\r\n    \r\n    global issueBtn,labelFrame,lb1,inf1,inf2,quitBtn,root,Canvas1,status\r\n    \r\n    bid = inf1.get()\r\n    issueto = inf2.get()\r\n\r\n    issueBtn.destroy()\r\n    labelFrame.destroy()\r\n    lb1.destroy()\r\n    inf1.destroy()\r\n    inf2.destroy()\r\n    \r\n    \r\n    extractBid = \"select bid from \"+bookTable\r\n    try:\r\n        cur.execute(extractBid)\r\n        con.commit()\r\n        for i in cur:\r\n            allBid.append(i[0])\r\n        \r\n        if bid in allBid:\r\n            checkAvail = \"select status from \"+bookTable+\" where bid = '\"+bid+\"'\"\r\n            cur.execute(checkAvail)\r\n            con.commit()\r\n            for i in cur:\r\n                check = i[0]\r\n                \r\n            if check == 'avail':\r\n                status = True\r\n            else:\r\n                status = False\r\n\r\n        else:\r\n            messagebox.showinfo(\"Error\",\"Book ID not present\")\r\n    except:\r\n        messagebox.showinfo(\"Error\",\"Can't fetch Book IDs\")\r\n    \r\n    issueSql = \"insert into \"+issueTable+\" values ('\"+bid+\"','\"+issueto+\"')\"\r\n    show = \"select * from \"+issueTable\r\n    \r\n    updateStatus = \"update \"+bookTable+\" set status = 'issued' where bid = '\"+bid+\"'\"\r\n    try:\r\n        if bid in allBid and status == True:\r\n            cur.execute(issueSql)\r\n            con.commit()\r\n            cur.execute(updateStatus)\r\n            con.commit()\r\n            messagebox.showinfo('Success',\"Book Issued Successfully\")\r\n            root.destroy()\r\n        else:\r\n            allBid.clear()\r\n            messagebox.showinfo('Message',\"Book Already Issued\")\r\n            root.destroy()\r\n            return\r\n    except:\r\n        messagebox.showinfo(\"Search Error\",\"The value entered is wrong, Try again\")\r\n\r\n    print(bid)\r\n    print(issueto)\r\n    \r\n    allBid.clear()\r\n<\/pre>\n<p><strong>Explanation:<\/strong><\/p>\n<p>Primarily, we fetch the desired book ID and Issuer\u2019s name and store it into <strong>bid<\/strong> and <strong>issueto<\/strong> respectively.<\/p>\n<p>After that we store all the Book ID from the <strong>books<\/strong> table in <strong>allBid<\/strong> by executing the SQL query stored in <strong>extractBid<\/strong>.<\/p>\n<p>We check for the existence of the desired <strong>bid<\/strong> in <strong>allBid<\/strong>. If it exists and is available, we set the <strong>status<\/strong> as <strong>True<\/strong>.<\/p>\n<p>If the book is available we update the <strong>books_issued<\/strong> table with the book id (<strong>bid<\/strong>) and Issuer\u2019s name (<strong>issueto<\/strong>) and update the <strong>books<\/strong> table by changing the status of the issued book to \u2018<strong>issued<\/strong>\u2019.<\/p>\n<p><strong>5.4. Function &#8211; issueBook()<\/strong><\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">def issueBook(): \r\n    \r\n    global issueBtn,labelFrame,lb1,inf1,inf2,quitBtn,root,Canvas1,status\r\n    \r\n    root = Tk()\r\n    root.title(\"Library\")\r\n    root.minsize(width=400,height=400)\r\n    root.geometry(\"600x500\")\r\n    \r\n    Canvas1 = Canvas(root)\r\n    Canvas1.config(bg=\"#D6ED17\")\r\n    Canvas1.pack(expand=True,fill=BOTH)\r\n\r\n    headingFrame1 = Frame(root,bg=\"#FFBB00\",bd=5)\r\n    headingFrame1.place(relx=0.25,rely=0.1,relwidth=0.5,relheight=0.13)\r\n        \r\n    headingLabel = Label(headingFrame1, text=\"Issue Book\", bg='black', fg='white', font=('Courier',15))\r\n    headingLabel.place(relx=0,rely=0, relwidth=1, relheight=1)\r\n    \r\n    labelFrame = Frame(root,bg='black')\r\n    labelFrame.place(relx=0.1,rely=0.3,relwidth=0.8,relheight=0.5)  \r\n        \r\n    # Book ID\r\n    lb1 = Label(labelFrame,text=\"Book ID : \", bg='black', fg='white')\r\n    lb1.place(relx=0.05,rely=0.2)\r\n        \r\n    inf1 = Entry(labelFrame)\r\n    inf1.place(relx=0.3,rely=0.2, relwidth=0.62)\r\n    \r\n    # Issued To Student name \r\n    lb2 = Label(labelFrame,text=\"Issued To : \", bg='black', fg='white')\r\n    lb2.place(relx=0.05,rely=0.4)\r\n        \r\n    inf2 = Entry(labelFrame)\r\n    inf2.place(relx=0.3,rely=0.4, relwidth=0.62)\r\n    \r\n    \r\n    #Issue Button\r\n    issueBtn = Button(root,text=\"Issue\",bg='#d1ccc0', fg='black',command=issue)\r\n    issueBtn.place(relx=0.28,rely=0.9, relwidth=0.18,relheight=0.08)\r\n    \r\n    quitBtn = Button(root,text=\"Quit\",bg='#aaa69d', fg='black', command=root.destroy)\r\n    quitBtn.place(relx=0.53,rely=0.9, relwidth=0.18,relheight=0.08)\r\n    \r\n    root.mainloop()\r\n\r\n<\/pre>\n<p><strong>Explanation:<\/strong><\/p>\n<p>We create and place a <strong>headingFrame<\/strong> and two input fields for taking input of the desired books\u2019 ID and issuers\u2019 name. After which we create and add two buttons named <strong>issueBtn<\/strong> and <strong>quitBtn<\/strong> to facilitate submission of our issue request and closing the present window of library management system respectively.<\/p>\n<h4>6. ReturnBook.py<\/h4>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/return-book.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-80339\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/return-book.png\" alt=\"return book\" width=\"752\" height=\"665\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/return-book.png 752w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/return-book-300x265.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/return-book-150x133.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/return-book-520x460.png 520w\" sizes=\"auto, (max-width: 752px) 100vw, 752px\" \/><\/a><\/p>\n<p><strong>6.1. Importing the necessary modules<\/strong><\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">from tkinter import *\r\nfrom PIL import ImageTk,Image\r\nfrom tkinter import messagebox\r\nimport pymysql\r\n<\/pre>\n<p><strong>6.2. Connecting to the MySql server<\/strong><\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">mypass = \"root\"\r\nmydatabase=\"db\"\r\n\r\ncon = pymysql.connect(host=\"localhost\",user=\"root\", password=mypass,database=mydatabase)\r\ncur = con.cursor()\r\n\r\n# Enter Table Names here\r\nissueTable = \"books_issued\" \r\nbookTable = \"books\"\r\n\r\nallBid = []  #To store all the Book ID\u2019s\r\n<\/pre>\n<p><strong>6.3. Function &#8211; returnn()<\/strong><\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">def returnn():\r\n    \r\n    global SubmitBtn,labelFrame,lb1,bookInfo1,quitBtn,root,Canvas1,status\r\n    \r\n    bid = bookInfo1.get()\r\n\r\n    extractBid = \"select bid from \"+issueTable\r\n    try:\r\n        cur.execute(extractBid)\r\n        con.commit()\r\n        for i in cur:\r\n            allBid.append(i[0])\r\n        \r\n        if bid in allBid:\r\n            checkAvail = \"select status from \"+bookTable+\" where bid = '\"+bid+\"'\"\r\n            cur.execute(checkAvail)\r\n            con.commit()\r\n            for i in cur:\r\n                check = i[0]\r\n                \r\n            if check == 'issued':\r\n                status = True\r\n            else:\r\n                status = False\r\n\r\n        else:\r\n            messagebox.showinfo(\"Error\",\"Book ID not present\")\r\n    except:\r\n        messagebox.showinfo(\"Error\",\"Can't fetch Book IDs\")\r\n    \r\n    \r\n    issueSql = \"delete from \"+issueTable+\" where bid = '\"+bid+\"'\"\r\n    \r\n    print(bid in allBid)\r\n    print(status)\r\n    updateStatus = \"update \"+bookTable+\" set status = 'avail' where bid = '\"+bid+\"'\"\r\n    try:\r\n        if bid in allBid and status == True:\r\n            cur.execute(issueSql)\r\n            con.commit()\r\n            cur.execute(updateStatus)\r\n            con.commit()\r\n            messagebox.showinfo('Success',\"Book Returned Successfully\")\r\n        else:\r\n            allBid.clear()\r\n            messagebox.showinfo('Message',\"Please check the book ID\")\r\n            root.destroy()\r\n            return\r\n    except:\r\n        messagebox.showinfo(\"Search Error\",\"The value entered is wrong, Try again\")\r\n    \r\n    \r\n    allBid.clear()\r\n    root.destroy()\r\n\r\n<\/pre>\n<p><strong>Explanation:<\/strong><\/p>\n<p>This function is similar to the <strong>issue()<\/strong> function we designed for <strong>issueBook.py<\/strong>.<\/p>\n<p>In this library management system project, we fetch the desired book ID and store it into <strong>bid<\/strong>.<\/p>\n<p>After that we store all the Book IDs from the <strong>books_issued<\/strong> table in <strong>allBid<\/strong> by executing the SQL query stored in <strong>extractBid<\/strong>.<\/p>\n<p>We check for the existence of the desired <strong>bid<\/strong> in <strong>allBid<\/strong>. Also, we check the status of the same book and if it is \u2018<strong>issued<\/strong>\u2019, we set the <strong>status<\/strong> as <strong>True<\/strong>.<\/p>\n<p>Then, we remove the record from <strong>books_issued<\/strong> table and update the <strong>books<\/strong> table by changing the status of the issued book to \u2018<strong>avail<\/strong>\u2019.<\/p>\n<p><strong>6.4. Function &#8211; returnBook()<\/strong><\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">def returnBook(): \r\n    \r\n    global bookInfo1,SubmitBtn,quitBtn,Canvas1,con,cur,root,labelFrame, lb1\r\n    \r\n    root = Tk()\r\n    root.title(\"Library\")\r\n    root.minsize(width=400,height=400)\r\n    root.geometry(\"600x500\")\r\n\r\n\r\n    Canvas1 = Canvas(root)\r\n    \r\n    Canvas1.config(bg=\"#006B38\")\r\n    Canvas1.pack(expand=True,fill=BOTH)\r\n        \r\n    headingFrame1 = Frame(root,bg=\"#FFBB00\",bd=5)\r\n    headingFrame1.place(relx=0.25,rely=0.1,relwidth=0.5,relheight=0.13)\r\n        \r\n    headingLabel = Label(headingFrame1, text=\"Return Book\", bg='black', fg='white', font=('Courier',15))\r\n    headingLabel.place(relx=0,rely=0, relwidth=1, relheight=1)\r\n    \r\n    labelFrame = Frame(root,bg='black')\r\n    labelFrame.place(relx=0.1,rely=0.3,relwidth=0.8,relheight=0.5)   \r\n        \r\n    # Book ID to Delete\r\n    lb1 = Label(labelFrame,text=\"Book ID : \", bg='black', fg='white')\r\n    lb1.place(relx=0.05,rely=0.5)\r\n        \r\n    bookInfo1 = Entry(labelFrame)\r\n    bookInfo1.place(relx=0.3,rely=0.5, relwidth=0.62)\r\n    \r\n    #Submit Button\r\n    SubmitBtn = Button(root,text=\"Return\",bg='#d1ccc0', fg='black',command=returnn)\r\n    SubmitBtn.place(relx=0.28,rely=0.9, relwidth=0.18,relheight=0.08)\r\n    \r\n    quitBtn = Button(root,text=\"Quit\",bg='#f7f1e3', fg='black', command=root.destroy)\r\n    quitBtn.place(relx=0.53,rely=0.9, relwidth=0.18,relheight=0.08)\r\n    \r\n    root.mainloop()\r\n\r\n<\/pre>\n<p><strong>Explanation:<\/strong><\/p>\n<p>We create and place a <strong>headingFrame<\/strong> and an input field for taking input of the books\u2019 ID. Then, we create and add two buttons named <strong>SubmitBtn<\/strong> and <strong>quitBtn<\/strong> to facilitate submission of our return request and closing the present window respectively.<\/p>\n<h2>Summary<\/h2>\n<p>Hooray! we have successfully designed a Library management system using python and tkinter with a decent UI. In order to make things easy, this tutorial divided the various tasks into different python files. In the real world, we follow such practices to make things easy to build. Hence, whenever making a project, divide your goals into modules and integrate them at a later stage.<\/p>\n<p>Apart from this, you can now take a step forward to extend the project by making a history tab which keeps track of the previous books issued. Moreover, you can integrate a login system to authenticate a user before making changes to the database.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Work on one of the most popular python projects &#8211; Library Management System A library management system keeps track of the books present in the library. It is an important piece of software which&#46;&#46;&#46;<\/p>\n","protected":false},"author":7,"featured_media":80340,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[46],"tags":[22863,22864,21680,21082,22734],"class_list":["post-80297","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python","tag-library-management-system","tag-library-project","tag-python-library-management-system","tag-python-project","tag-python-project-for-beginners"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Library Management System - Python Project with Source Code - DataFlair<\/title>\n<meta name=\"description\" content=\"Library management system in python - This is one of the most popular project among college students \/ beginners. Work on a real-time project to gain expertise in python.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/library-management-system-python-project\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Library Management System - Python Project with Source Code - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Library management system in python - This is one of the most popular project among college students \/ beginners. Work on a real-time project to gain expertise in python.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/library-management-system-python-project\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2020-08-06T08:46:09+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-03-08T12:55:14+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/library-management-system-python-project.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"17 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Library Management System - Python Project with Source Code - DataFlair","description":"Library management system in python - This is one of the most popular project among college students \/ beginners. Work on a real-time project to gain expertise in python.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/data-flair.training\/blogs\/library-management-system-python-project\/","og_locale":"en_US","og_type":"article","og_title":"Library Management System - Python Project with Source Code - DataFlair","og_description":"Library management system in python - This is one of the most popular project among college students \/ beginners. Work on a real-time project to gain expertise in python.","og_url":"https:\/\/data-flair.training\/blogs\/library-management-system-python-project\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2020-08-06T08:46:09+00:00","article_modified_time":"2021-03-08T12:55:14+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/library-management-system-python-project.jpg","type":"image\/jpeg"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"17 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/library-management-system-python-project\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/library-management-system-python-project\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/beb0cab24b7aa54423a3b50e669a9dcd"},"headline":"Library Management System &#8211; Python Project with Source Code","datePublished":"2020-08-06T08:46:09+00:00","dateModified":"2021-03-08T12:55:14+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/library-management-system-python-project\/"},"wordCount":2094,"commentCount":93,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/library-management-system-python-project\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/library-management-system-python-project.jpg","keywords":["library management system","library project","Python Library Management System","Python project","python project for beginners"],"articleSection":["Python Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/library-management-system-python-project\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/library-management-system-python-project\/","url":"https:\/\/data-flair.training\/blogs\/library-management-system-python-project\/","name":"Library Management System - Python Project with Source Code - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/library-management-system-python-project\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/library-management-system-python-project\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/library-management-system-python-project.jpg","datePublished":"2020-08-06T08:46:09+00:00","dateModified":"2021-03-08T12:55:14+00:00","description":"Library management system in python - This is one of the most popular project among college students \/ beginners. Work on a real-time project to gain expertise in python.","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/library-management-system-python-project\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/library-management-system-python-project\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/library-management-system-python-project\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/library-management-system-python-project.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/library-management-system-python-project.jpg","width":1200,"height":628,"caption":"library management system python project"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/library-management-system-python-project\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"Python Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/python\/"},{"@type":"ListItem","position":3,"name":"Library Management System &#8211; Python Project with Source Code"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/beb0cab24b7aa54423a3b50e669a9dcd","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/c322416204232f4dd97ef3901b0a499a5d34d7ba7fe333f4bfe53a907873d293?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/c322416204232f4dd97ef3901b0a499a5d34d7ba7fe333f4bfe53a907873d293?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c322416204232f4dd97ef3901b0a499a5d34d7ba7fe333f4bfe53a907873d293?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"DataFlair Team specializes in creating clear, actionable content on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Backed by industry expertise, we make learning easy and career-oriented for beginners and pros alike.","url":"https:\/\/data-flair.training\/blogs\/author\/dfteam3\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/80297","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=80297"}],"version-history":[{"count":8,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/80297\/revisions"}],"predecessor-version":[{"id":86515,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/80297\/revisions\/86515"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/80340"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=80297"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=80297"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=80297"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}