Awesome-Python-Scripts/Folder Locker & Hider/application.pyw
Ayush Bhardwaj 922ad6db8b
update(README) : Badges and Contact links (#237)
* add yts_torrents project (#116)

* add yts_torrents project

* Added Python Script HacktoberFest 2019 (#128)

* Added whatsapp-message Script

* Update README.md

* Script: Importance Checker (Updated Project List) (#132)

* Add files to fork

* Update README.md

* Fixed ToDoBot link (#133)

To Do bot link was using "-" instead of %20

Changed path to folders

Removed full repo path to folders to make project robust to cloning as discussed on issue #139 on [AzureNotebooks](https://github.com/Microsoft/AzureNotebooks/issues/193).

Fixed clean up photo directory name

Fixed file organizer link

Script: Importance Checker (Updated Project List) (#132)

* Add files to fork

* Update README.md

Squash

Squash

Fixed ToDoBot link

To Do bot link was using "-" instead of %20

parent 7c58b564104cdd1990492276292f04ec19009e57
author MatTerra <mateus.b.s.terra@gmail.com> 1574710004 -0300
committer MatTerra <mateus.b.s.terra@gmail.com> 1574710650 -0300

Squash

Fixed ToDoBot link

To Do bot link was using "-" instead of %20

Squash

Changed path to folders

Removed full repo path to folders to make project robust to cloning as discussed on issue #139 on [AzureNotebooks](https://github.com/Microsoft/AzureNotebooks/issues/193).

Fixed ToDoBot link

To Do bot link was using "-" instead of %20

Script: Importance Checker (Updated Project List) (#132)

* Add files to fork

* Update README.md

* All changes made : Script added (#130)

* Added whatsapp-message Script

* Update README.md

Co-authored-by: Ayush Bhardwaj <classicayush@gmail.com>

* Revert "All changes made : Script added (#130)" (#135)

This reverts commit 74de9279f7.

* Add MIT license for project (#122)

Signed-off-by: Kaushlendra Pratap <kaushlendrapratap.9837@gmail.com>

* Add files via upload (#120)

* Bump requests from 2.18.4 to 2.20.0 in /Tweets_Tool (#137)

Bumps [requests](https://github.com/psf/requests) from 2.18.4 to 2.20.0.
- [Release notes](https://github.com/psf/requests/releases)
- [Changelog](https://github.com/psf/requests/blob/master/HISTORY.md)
- [Commits](https://github.com/psf/requests/compare/v2.18.4...v2.20.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump urllib3 from 1.22 to 1.24.2 in /Tweets_Tool (#136)

Bumps [urllib3](https://github.com/urllib3/urllib3) from 1.22 to 1.24.2.
- [Release notes](https://github.com/urllib3/urllib3/releases)
- [Changelog](https://github.com/urllib3/urllib3/blob/master/CHANGES.rst)
- [Commits](https://github.com/urllib3/urllib3/compare/1.22...1.24.2)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Ayush Bhardwaj <classicayush@gmail.com>

* Added Image Recognition Script (#109)

* Added face recognition script

* Updated README

Co-authored-by: Ayush Bhardwaj <classicayush@gmail.com>

* Instagram Video Downloader (#94)

* Instagram Video Downloader

downloads all the videos from instagram post

* Update README.md

Co-authored-by: Ayush Bhardwaj <classicayush@gmail.com>

* Wikipedia-Search (#87)

* Create pywikisearch.py

* Create README.md

* Update README.md

* Update README.md

* Update README.md

* Update pywikisearch.py

* Create requirements.txt (#1)

Co-authored-by: Ayush Bhardwaj <classicayush@gmail.com>

* Added PX to REM, REM to Px as command line tools (#82)

Co-authored-by: Atthaphon Urairat <aurairat@inetasia.com>
Co-authored-by: Ayush Bhardwaj <classicayush@gmail.com>

* Added an SSH host adder script, which allows you to add hosts to your ssh config file. (#76)

Co-authored-by: NinoCosmic <nikola.dokoski@cosmicdevelopment.com>
Co-authored-by: Ayush Bhardwaj <classicayush@gmail.com>

* Added RSA Algorithm used in cryptography (#61)

* Added RSA Algorithm

* Update README.md

* Create README.md

* Update README.md

* Add files via upload

* Update README.md

* Added RSA Algorithm

Co-authored-by: Ayush Bhardwaj <classicayush@gmail.com>

* fix table allignment

* python script which creates a map in html showing realtime covid stat… (#138)

* python script which creates a map in html showing realtime covid status in india

* remove extra space; fix allignment

Co-authored-by: Ayush Bhardwaj <classicayush@gmail.com>

* fix to covid visualiser, sometimes deaths are null (#139)

* Update README.md

* Added a Random_Email_Generator to the list of projects! (#141)

* Added Random Email Generator Python Script

* Create README.md

* Update README.md

* Update Random_email_generator.py

* Update Random_email_generator.py

* Update README.md

* Added Random Email Generator Python Script

Co-authored-by: shub-garg <shubhamsgcool@gmail.com>

* Ansh's Dictionary (#142)

Added a project of English Theasauras

* sudoku-solver (#144)

* Update file-organizer.py

* Update README.md

* Add greeting.yml file

* Add PR template for the project

* update greetings.yml

* update greetings.yml

* Rename pull_request_template.md to PULL_REQUEST_TEMPLATE.md

* Update greetings.yml

* Delete greetings.yml

* Added Py_Cleaner (#162)

* Update README.md

* Added Py_Cleaner

* Toonify Scripts (#154)

* Toonify Script Added

* Update README.md

* Update toonify-API-2.py

* Added git automation to repo (#171)

Added gitAutomation to README.md

refactoring

* Added Fibonacci_Sequence_Generator and updated main README.md accordingly (#173)

* Tambola tickets generator (#169)

* Adds utility to generate Tambola tickets

* Adds utility to generate Tambola tickets

* Added script to send messages to sqs in parallel (#165)

* Added script to send messages to sqs in parallel

* Update README.md

* Added Codeforces Checker Python Script (#176)

* python script to create github repo (#178)

* Added python script to remove duplicate files from a directory (#179)

* create script

* create README.md

* updated README.md

* updated README.md

* added batch image watermarker (#184)

* added batch image watermarker

* Create README.md

* Update README.md to include project

* add script for convert pdf to text (#183)

Co-authored-by: pham.huu.quang <SUN-ASTERISK\pham.huu.quang@b121686-lt.sun-asterisk.com>

* Update README.md

* url_shortener files were added (#191)

url_shortener.py skel was created

the script has completed

README.md description and requirements.txt were added

The project was added to README.md

* Python script to view wifi password. (#163)

* Added wifi.py

* Delete main.py

* Create wifi_password.py

* Create requirements.txt

* Create README.md

* Rename wifi_password.py to main.py

* Update README.md

* Update README.md

Co-authored-by: Ayush Bhardwaj <classicayush@gmail.com>

* Added Python made News Generator HackerNews (#174)

* IMDB list querier project by Burak Bekci (#187)

Co-authored-by: Ayush Bhardwaj <classicayush@gmail.com>

* Added a Folder Manger Script. (#188)

* Added Folder_Manager

* Added Name to README.md

Co-authored-by: Ayush Bhardwaj <classicayush@gmail.com>

* Update README.md

* Simple 2048 GUI tkinter game in Python3 (#194)

* Simple 2048 GUI tkinter game in Python3

* added contributor to readme file

* added elastic-snapshot script  (#193)

* added elastic-snapshot script

* added project to the projects list

* updated requirements.txt

* Download page as pdf (#196)

* Download page as PDF.

* Contributor name.

* Pudim page typo.

* Added spotify downloader (#195)

Co-authored-by: Ayush Bhardwaj <classicayush@gmail.com>

* Github CLI tool added. (#198)

* GithubBot added

* add new project

* Update README.md

* Update README.md

* Added Independent RSA Communication Algorithm (#199)

* Added an indepedent RSA library

Added an indepedent RSA library with no depedences (adapted to communication)

* Created README.md

Created README.md

* Update README.md

* Added project to README.md

Added project "Independent RSA Communication Algorithm" to README.md

Co-authored-by: Ayush Bhardwaj <classicayush@gmail.com>

* Bump cryptography from 2.7 to 3.2 in /file-encrypt-decrypt (#201)

Bumps [cryptography](https://github.com/pyca/cryptography) from 2.7 to 3.2.
- [Release notes](https://github.com/pyca/cryptography/releases)
- [Changelog](https://github.com/pyca/cryptography/blob/master/CHANGELOG.rst)
- [Commits](https://github.com/pyca/cryptography/compare/2.7...3.2)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Add TranslateCLI (#200)

* Added automation for converting JSON to YAML format. (#197)

* Added automation for converting json to yaml format

* Create Readme.md

* Deletd the extra files

* Added requirements.txt

* Added name and project in project list

Co-authored-by: Ayush Bhardwaj <classicayush@gmail.com>

* Rock-Paper-Scissor Game (#202)

* Rock-Paper-Scissor-Game

* updated README.md

* Add instagram link

* remove quora link

* add portfolio

* update: portfolio (#208)

* fix(README): remove msg from last commit

* New Project (#206)

* Added folder locker and hider

* Update README.md

* Bump py from 1.9.0 to 1.10.0 in /file-encrypt-decrypt (#209)

Bumps [py](https://github.com/pytest-dev/py) from 1.9.0 to 1.10.0.
- [Release notes](https://github.com/pytest-dev/py/releases)
- [Changelog](https://github.com/pytest-dev/py/blob/master/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/py/compare/1.9.0...1.10.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump cryptography from 3.2 to 3.3.2 in /file-encrypt-decrypt (#210)

Bumps [cryptography](https://github.com/pyca/cryptography) from 3.2 to 3.3.2.
- [Release notes](https://github.com/pyca/cryptography/releases)
- [Changelog](https://github.com/pyca/cryptography/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pyca/cryptography/compare/3.2...3.3.2)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump urllib3 from 1.24.2 to 1.26.5 in /Tweets_Tool (#212)

Bumps [urllib3](https://github.com/urllib3/urllib3) from 1.24.2 to 1.26.5.
- [Release notes](https://github.com/urllib3/urllib3/releases)
- [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst)
- [Commits](https://github.com/urllib3/urllib3/compare/1.24.2...1.26.5)

---
updated-dependencies:
- dependency-name: urllib3
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump urllib3 from 1.25.11 to 1.26.5 in /Github_Bot (#213)

Bumps [urllib3](https://github.com/urllib3/urllib3) from 1.25.11 to 1.26.5.
- [Release notes](https://github.com/urllib3/urllib3/releases)
- [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst)
- [Commits](https://github.com/urllib3/urllib3/compare/1.25.11...1.26.5)

---
updated-dependencies:
- dependency-name: urllib3
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Added Image Compressor Script (#211)

* Added Readme.md

Gave a description of the project

* Added Image_Compressor 

Added image compressor script and a sample image to compress the image file to a reduced size.

* Updated README.md

Added my name in Contributors list.

* Created a Speed checking script in python 3 named TestMyInternetSpeed (#214)

* speedtest using python

* main python script for checking speeds

* Add files via upload

* Delete TestMySpeed.py

* Delete requirements.txt

* Delete README.md

* Update README.md

* Update README.md

* Revert "Delete README.md"

This reverts commit 8d14c3b3e6.

reverted the accidentally commited readme file commit

* added the readme file i deleted accidentally

* Update README.md

Co-authored-by: Dhruv Bansal <dhruvbansal@Dhruvs-MacBook-Air.local>

* Bump requests from 2.18.4 to 2.20.0 in /Tweets_Tool (#215)

Bumps [requests](https://github.com/psf/requests) from 2.18.4 to 2.20.0.
- [Release notes](https://github.com/psf/requests/releases)
- [Changelog](https://github.com/psf/requests/blob/master/HISTORY.md)
- [Commits](https://github.com/psf/requests/compare/v2.18.4...v2.20.0)

---
updated-dependencies:
- dependency-name: requests
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump urllib3 from 1.24.2 to 1.26.5 in /Tweets_Tool (#216)

Bumps [urllib3](https://github.com/urllib3/urllib3) from 1.24.2 to 1.26.5.
- [Release notes](https://github.com/urllib3/urllib3/releases)
- [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst)
- [Commits](https://github.com/urllib3/urllib3/compare/1.24.2...1.26.5)

---
updated-dependencies:
- dependency-name: urllib3
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Ayush Bhardwaj <classicayush@gmail.com>

* Bump requests from 2.18.4 to 2.20.0 in /Tweets_Tool (#217)

Bumps [requests](https://github.com/psf/requests) from 2.18.4 to 2.20.0.
- [Release notes](https://github.com/psf/requests/releases)
- [Changelog](https://github.com/psf/requests/blob/master/HISTORY.md)
- [Commits](https://github.com/psf/requests/compare/v2.18.4...v2.20.0)

---
updated-dependencies:
- dependency-name: requests
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Add my script PLAGIARISM_DETECTOR to the repo (#218)

* AI simulation for guessing the number (#219)

* Add files via upload

* Create README.md

* Create Requirements

* Update README.md

* Added CSV to Excel writer (#222)

* Added Cryptocurrency prices (#223)

* Added Cryptocurrency prices

* Update README.md

* Add the word frequency counter (#225)

* Battery notification (#227)

* Create Battery_notification.py

* Create README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* add Harry Potter Cloak script using Open-CV (#228)

* add Harry Potter Cloak script using Open-CV

* add Indian Flag using Turtle

* Delete README.md

* Delete main.py

* Update README.md

* Update README.md (#146)

* Csv_to_json (#224)

* Added csv_to_json script

* added requirements.txt file

* added images

* Added README.md

* Added my details

* Add the website URL detector (#230)

* README fix (#231)

* Updated README

* Images fix

* Link fix

* fix broken hit counter button (#232)

* add awesome repo button (#233)

* Added Steg_Tool Script (#234)

Co-authored-by: Shankar JP <shankarjp12@outlook.com>

Co-authored-by: Mayank Nader <34679965+makkoncept@users.noreply.github.com>
Co-authored-by: mukeshprasad <44356982+mukeshprasad@users.noreply.github.com>
Co-authored-by: natesabrown <45186473+natesabrown@users.noreply.github.com>
Co-authored-by: Mateus Berardo de Souza Terra <mateus.b.s.terra@gmail.com>
Co-authored-by: Kaushlendra Pratap <41343571+Kaushl2208@users.noreply.github.com>
Co-authored-by: Sarah Floris <sdf94@uw.edu>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: LOKESH KHURANA <35563030+theluvvkhurana@users.noreply.github.com>
Co-authored-by: Shobhit Bhosure <38807205+shobhit99@users.noreply.github.com>
Co-authored-by: Nissaar <34180849+Nissaar@users.noreply.github.com>
Co-authored-by: Atthaphon Urairat <u.atthaphon@gmail.com>
Co-authored-by: Atthaphon Urairat <aurairat@inetasia.com>
Co-authored-by: Nikola Dokoski (Nino) <ninodokoskiot@hotmail.com>
Co-authored-by: NinoCosmic <nikola.dokoski@cosmicdevelopment.com>
Co-authored-by: Chinmay Rane <chinmayrane16@gmail.com>
Co-authored-by: tushar5526 <30565750+tushar5526@users.noreply.github.com>
Co-authored-by: joec237 <37048612+joec237@users.noreply.github.com>
Co-authored-by: SHUBHAM GARG <52582943+shub-garg@users.noreply.github.com>
Co-authored-by: shub-garg <shubhamsgcool@gmail.com>
Co-authored-by: Ansh Dhingra <56676059+anshdhinhgra47@users.noreply.github.com>
Co-authored-by: ayedaemon <39592651+ayedaemon@users.noreply.github.com>
Co-authored-by: Abhishek <55457501+Abhishek-Dobliyal@users.noreply.github.com>
Co-authored-by: Chetan Pandey <chetanpandey1266@gmail.com>
Co-authored-by: loge1998 <38487437+loge1998@users.noreply.github.com>
Co-authored-by: JohnWesleyK <59068112+JohnWesleyK@users.noreply.github.com>
Co-authored-by: Synster <amandeepkalra.kalra@gmail.com>
Co-authored-by: Jinam Shah <40169508+jinamshah@users.noreply.github.com>
Co-authored-by: Jinesh Parakh <50925060+jineshparakh@users.noreply.github.com>
Co-authored-by: HARISH KUMAR  TIWARI <harishtiwary46@gmail.com>
Co-authored-by: Aayushi Varma <59158445+aayuv17@users.noreply.github.com>
Co-authored-by: Remco Halman <remco.halman@gmail.com>
Co-authored-by: QuangPH <55747283+quangph-1686a@users.noreply.github.com>
Co-authored-by: pham.huu.quang <SUN-ASTERISK\pham.huu.quang@b121686-lt.sun-asterisk.com>
Co-authored-by: Sam Ebison <ebsa491@gmail.com>
Co-authored-by: sagar627 <55939746+sagar627@users.noreply.github.com>
Co-authored-by: Atharva Ashok Patil <39415890+Attupatil@users.noreply.github.com>
Co-authored-by: Burak Bekci <bekciburak97@gmail.com>
Co-authored-by: Harsh Raj <rafftar98@gmail.com>
Co-authored-by: gitkp <47073116+gitkp11@users.noreply.github.com>
Co-authored-by: Joe <joe@clanryan.us>
Co-authored-by: Jeremias Moreira Gomes <j3r3miasmg@gmail.com>
Co-authored-by: Abhilasha Sinha <43816262+Abhilasha06@users.noreply.github.com>
Co-authored-by: dec0 <35975131+wi6n3l@users.noreply.github.com>
Co-authored-by: Rodrigo Oliveira <rodrigo.redcode@gmail.com>
Co-authored-by: stark117 <55136108+saksham117@users.noreply.github.com>
Co-authored-by: Punit Sakre <punitsakre786@gmail.com>
Co-authored-by: Rashmi Singh <72220428+rashmiprabhat567@users.noreply.github.com>
Co-authored-by: Prajjwal Pathak <71623767+pyGuru123@users.noreply.github.com>
Co-authored-by: Prathima Kadari <kadariprathima4@gmail.com>
Co-authored-by: Dhruv Bansal <dhruvbansal237@gmail.com>
Co-authored-by: Dhruv Bansal <dhruvbansal@Dhruvs-MacBook-Air.local>
Co-authored-by: Akshita Singhal <56424809+akshitasinghal4444@users.noreply.github.com>
Co-authored-by: ShadowHunter15 <72161983+ShadowHunter15@users.noreply.github.com>
Co-authored-by: Muhammed Ali Dilek <xemeds@protonmail.com>
Co-authored-by: Sonya Nikiforova <son.nik@mail.ru>
Co-authored-by: Krishna Sharma <krishnasharma1386@gmail.com>
Co-authored-by: TanmayNagdeve <55934827+TanmayNagdeve@users.noreply.github.com>
Co-authored-by: MoiZ <techboyy6@gmail.com>
Co-authored-by: shreyas-lab <68059145+shreyas-lab@users.noreply.github.com>
Co-authored-by: Shankar Jayaprakash <79354504+shankarjp@users.noreply.github.com>
Co-authored-by: Shankar JP <shankarjp12@outlook.com>
2021-10-16 01:00:07 +05:30

223 lines
7.5 KiB
Python

import locker
import os
import tkinter as tk
from tkinter import PhotoImage
from tkinter import messagebox
from tkinter import filedialog
cwd = os.getcwd()
if not os.path.exists('files/'):
os.mkdir('files')
class Application(tk.Frame):
def __init__(self, master):
super().__init__(master=master)
self.master = master
self.pack()
self.title_frame()
self.main_frame()
self.status_frame()
self.folder_path = ''
self.fname = ''
def title_frame(self):
self.title = tk.Label(self, bg='gray',font=("Helvetica", 14), anchor='w')
self.title.configure(width=35, height=3)
self.title['text'] = '\t Folder Locker / Unlocker'
self.title.grid(row=0, column=0, columnspan=2)
def body_frame(self):
self.body = tk.Frame(self, width=390, height=230)
self.body.grid(row=1, column=0, columnspan=2, pady=10)
def status_frame(self):
self.status = tk.Text(self, width=50, height=3, fg='dodger blue')
self.status.insert(tk.END, 'The folder you lock will be hidden automatically\n')
self.status.insert(tk.END, 'Use the app to unlock it back')
self.status.configure(state='disabled')
self.status.grid(row=2, column=0, columnspan=2)
def main_frame(self):
self.body_frame()
self.lock_button = tk.Button(self.body, font =('Verdana', 15), command=self.lock_frame)
self.lock_button['image'] = lock_icon
self.lock_button['compound'] = tk.TOP
self.lock_button['text'] = 'Lock \nFolder'
self.lock_button.configure(width=120, height=120)
self.lock_button.grid(row=0, column=0, padx=(0,30), pady=(20,7))
self.unlock_button = tk.Button(self.body, font =('Verdana', 15), command=self.unlock_frame)
self.unlock_button['image'] = unlock_icon
self.unlock_button['compound'] = tk.TOP
self.unlock_button['text'] = ' Unlock \nFolder'
self.unlock_button.configure(width=120, height=120)
self.unlock_button.grid(row=0, column=1, padx=(30,0), pady=(20,7))
def lock_frame(self):
self.body.destroy()
self.body_frame()
self.status.configure(state='normal')
self.status.delete(1.0, tk.END)
self.status.insert(tk.END, 'Choose a folder, enter password and click lock\n')
self.status.insert(tk.END, 'folder to lock and hide the folder')
self.status.configure(state='disabled')
self.password = tk.StringVar()
self.pathlabel = tk.Label(self.body, bg='white', fg='black',
borderwidth=1, relief='groove', wraplength=150)
self.pathlabel['text'] = 'Select Folder'
self.pathlabel.configure(width=22, height=3)
self.pathlabel.grid(row=0, column=0, pady=10, padx=15)
self.choose_folder = tk.Button(self.body, image=choose_folder_icon)
self.choose_folder['command'] = self.select_folder
self.choose_folder.grid(row=0, column=1, padx=(20,5), pady=10)
self.back = tk.Button(self.body, image=back_icon)
self.back['command'] = self.go_back
self.back.grid(row=0, column=2, padx=(20,5), pady=10)
self.elabel = tk.Label(self.body, anchor='e')
self.elabel['text'] = 'Enter Password'
self.elabel.grid(row=1, column=0, pady=20)
self.entry = tk.Entry(self.body)
self.entry['textvariable'] = self.password
self.entry.grid(row=1, column=1, columnspan=2, pady=20)
self.lock =tk.Button(self.body, bg='green', width=20)
self.lock['text'] = f'Lock Folder'
self.lock['command'] = lambda : self.lock_folder(self.folder_path)
self.lock.grid(row=2, column=0, columnspan=3)
def unlock_frame(self):
self.body.destroy()
self.body_frame()
self.password = tk.StringVar()
self.pathlabel = tk.Label(self.body, bg='white', fg='black',
borderwidth=1, relief='groove', wraplength=150)
self.pathlabel['text'] = 'Select Folder'
self.pathlabel.configure(width=22, height=3)
self.pathlabel.grid(row=0, column=0, pady=2, padx=15)
self.back = tk.Button(self.body, image=back_icon)
self.back['command'] = self.go_back
self.back.grid(row=0, column=1, padx=(20,5), pady=2)
self.scrollbar = tk.Scrollbar(self.body, orient=tk.VERTICAL)
self.scrollbar.grid(row=0,column=3, rowspan=4, sticky='ns')
self.list = tk.Listbox(self.body, selectmode=tk.SINGLE,
yscrollcommand=self.scrollbar.set, selectbackground='sky blue')
self.list.config(height=10)
self.enumerate_folders()
self.list.bind('<Double-1>', self.get_folder)
self.scrollbar.config(command=self.list.yview)
self.list.grid(row=0, column=2, rowspan=4)
self.elabel = tk.Label(self.body, anchor='e')
self.elabel['text'] = 'Enter Password'
self.elabel.grid(row=1, column=0, columnspan=2, pady=(1,1))
self.entry = tk.Entry(self.body)
self.entry['textvariable'] = self.password
self.entry.grid(row=2, column=0, columnspan=2)
self.unlock =tk.Button(self.body, bg='green', width=20)
self.unlock['text'] = f'Unlock Folder'
self.unlock['command'] = lambda : self.unlock_folder(self.fname)
self.unlock.grid(row=3, column=0, columnspan=2, pady=(10,0))
def go_back(self):
self.body.destroy()
self.main_frame()
self.status.configure(state='normal')
self.status.delete(1.0, tk.END)
self.status.insert(tk.END, 'The folder you lock will be hidden automatically\n')
self.status.insert(tk.END, 'Use the app to unlock it back')
self.status.configure(state='disabled')
def select_folder(self):
self.folder_path = filedialog.askdirectory(initialdir=cwd)
self.pathlabel['anchor'] = 'w'
self.pathlabel['text'] = self.folder_path
def enumerate_folders(self):
self.dct = locker.read_json()
self.folders_list = list(self.dct.keys())
self.status.configure(state='normal')
self.status.delete(1.0, tk.END)
if len(self.folders_list) > 0:
for index, fname in enumerate(self.folders_list):
self.list.insert(index, fname)
self.status.insert(tk.END, 'Choose a folder, enter password and click unlock\n')
self.status.insert(tk.END, 'folder to unlock the folder')
else:
self.status.insert(tk.END, '0 folders locked yet\n')
self.status.configure(state='disabled')
def get_folder(self, event):
if event is not None:
self.current = self.list.curselection()[0]
self.folder_path = self.dct[self.folders_list[self.current]][0]
self.key = self.dct[self.folders_list[self.current]][1]
self.pathlabel['text'] = self.folder_path
def lock_folder(self, path):
password = self.entry.get()
if not self.folder_path == '':
if len(password) <= 4:
messagebox.showerror('Failed to lock', 'password is too short')
else:
status = locker.lock(self.folder_path, password)
if status == 'failed':
messagebox.showerror('Failed to lock', 'A folder with this name already locked')
else:
messagebox.showinfo('Folder status', 'Locked successfully')
self.password.set('')
self.pathlabel['anchor'] = 'c'
self.pathlabel['text'] = 'Select Folder'
def unlock_folder(self, fname):
password = self.entry.get()
if not self.folder_path == '':
if len(password) <= 4:
messagebox.showerror('Failed to unlock', 'password is too short')
else:
status = locker.unlock(self.folder_path, password, self.key)
if status == 'failed':
messagebox.showerror('Failed to unlock', 'Incorrect Password')
else:
messagebox.showinfo('Folder status', 'Folder unlocked successfully')
self.password.set('')
self.pathlabel['anchor'] = 'c'
self.pathlabel['text'] = 'Select Folder'
self.list.delete(0, tk.END)
self.enumerate_folders()
if __name__ == '__main__':
root = tk.Tk()
root.geometry('400x305')
root.title('Folder Locker/Unlocker')
root.resizable(0,0)
lock_icon = PhotoImage(file='icons/lock.png').subsample(2,2)
unlock_icon = PhotoImage(file='icons/unlock.png').subsample(2,2)
back_icon = PhotoImage(file='icons/back.png')
choose_folder_icon = PhotoImage(file='icons/choose_folder.png')
app = Application(master=root)
app.mainloop()