gasilvn.blogg.se

Homework website blocker
Homework website blocker




  1. #Homework website blocker install
  2. #Homework website blocker plus
  3. #Homework website blocker free

  • Here we have created one Label using the Tkinter library.
  • Creating Labels and Buttons: label1=Label(window, text ='Enter Website :', font ='arial 13 bold')Įnter_Website = Text(window,font = 'arial',height='2', width = '40') And if there is no such website in the host file we simply display the label – “Already Unblocked”.Ħ.
  • We read the content of the file and if the entered website is present we rewrite all the content in the file except the one we need to unblock and display the label “Unblocked.
  • If a website is already Unblocked and isn’t a part of the host file then display label – “Already Unblocked”. If a website is blocked and we click on the Unblock button a label “Unblocked” is displayed.
  • The Unblock() function is created so that we can unblock a website that is already blocked and is present in the host file.
  • Label(window, text = "UnBlocked", font = 'arial').place(x=350,y =200)ĭisplay=Label(window, text = 'Already UnBlocked', font = 'arial')
  • After opening the file, with help of a loop we check if the website entered is already present then display label “Already Blocked” and if it is not present add it to the file using write() method and then display label as “Blocked”.
  • Here we used (,) as our delimiter to separate the website list.
  • split() – this method is used to separate the content of the text area.
  • #Homework website blocker plus

    Here we have opened the host file in r+ mode which is read plus write mode. open() – this is for opening the host file.get() – this method is used to get the text that is added to the enter_website label.If the website is already in the host file then a label ‘Already Blocked ’ will be displayed. We have created this block function so that when we add any website to the text area and click on the block button, the website will be added to the host file and will be blocked.Host_file.write(ip_address + " " + web + '\n') With open (host_path, 'r+') as host_file:ĭisplay=Label(window, text = 'Already Blocked', font = 'arial') Website_lists = enter_Website.get(1.0,END) So here we give our local ip address and path of the host file. As we want the websites to be blocked in our system we need to add those websites in the host file.Host Path and IP Address: host_path ='C:\Windows\System32\drivers\etc\hosts' We have used Label() to create the label and pack() to pack the heading label to the window.ģ. Here we have created a Label named heading which is for giving a heading to the window.title() – provides an appropriate title to the window.minsize(), maxsize() – this function is for giving the minimum and maximum size to the window.Geometry() – this function is used to give size to the window.tk()- helps us create an empty window where we can add labels and buttons.Heading=Label(window, text ='Website Blocker', font ='arial') Window.title(" DataFlair Website Blocker") Import * means importing all the methods and functions from the tkinter library.We will only require Tkinter Module to create GUI in Python. Let us start building the python project following the given steps 1.

    homework website blocker

  • Creating Unblock function to unblock websites.
  • homework website blocker homework website blocker

    Creating Block function to block websites.Let us have a look at the steps we will be performing to create the Python Website Blocker project

    #Homework website blocker install

    To use Tkinter Module we need to install it using the following command: pip install tk Download the Source Codeīefore proceeding with the project, please download the source code of python website blocker from the following link: Website Blocker Project Project File Structure This project requires basic understanding of Python like defining functions, creating loops etc. Python Website Blocker Project Prerequisites These websites are added to the host file of the system. As the names suggest these functions will perform blocking and unblocking of websites respectively. We will be making two functions Block() and Unblock(). While creating Python Website Blocker Application, we are going to use only one module – Tkinter Module to make easy GUI using Python. We will also have an unblock feature added to it so that we can unblock any website in future if we want and Tkinter Module for creating GUI. We are going to create a website blocker using python which will give us a window where we can type the url of the websites and then we can block those websites. This is where a Website Blocker helps us. There are certain times when we face the need to block different websites on our system. Instead of using other applications to block websites on your system, why not create our own website blocker application using Python? Let us master Python by making yet another mini-project.

    #Homework website blocker free

    Free Python course with 35 real-time projects Start Now!!






    Homework website blocker