Skip to content

Commit 71a3d55

Browse files
authored
Merge pull request #4 from Ronit049/Ronit049-patch-3
Add files via upload
2 parents 909a50b + 323acd4 commit 71a3d55

File tree

5 files changed

+121
-0
lines changed

5 files changed

+121
-0
lines changed

Digital CLock by python/main.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import tkinter as tk
2+
from time import strftime
3+
4+
root = tk.Tk()
5+
root.title("Digital Clock")
6+
7+
def time():
8+
string = strftime('%H:%M:%S %p \n %D')
9+
label.config(text=string)
10+
label.after(1000,time)
11+
label = tk.Label(root, font=('calibri',50,'bold'), background='yellow',foreground='black')
12+
label.pack(anchor='center')
13+
14+
time()
15+
16+
root.mainloop()

File Management App/app1.py

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
import os
2+
3+
def create_file(filename):
4+
try:
5+
with open(filename, 'x') as f:
6+
print(f"File name {filename}: Created successfully!")
7+
except FileExistsError:
8+
print(f'File name {filename} already exists!')
9+
except Exception as e:
10+
print('An error occurred!')
11+
12+
def view_all_file():
13+
files = os.listdir()
14+
if not files:
15+
print('No file found!')
16+
else:
17+
print('Files in directory:')
18+
for file in files:
19+
print(file)
20+
21+
def delete_file(filename):
22+
try:
23+
os.remove(filename)
24+
print(f'{filename} has been deleted successfully!')
25+
except FileNotFoundError:
26+
print('File not found!')
27+
except Exception as e:
28+
print('An error occurred!')
29+
30+
def read_file(filename):
31+
try:
32+
with open(filename, 'r') as f:
33+
content = f.read()
34+
print(f"Content of '{filename}':\n{content}")
35+
except FileNotFoundError:
36+
print(f"{filename} doesn't exist!")
37+
except Exception as e:
38+
print('An error occurred!')
39+
40+
def edit_file(filename):
41+
try:
42+
with open(filename,'a') as f:
43+
content = input("Enter data to add = ")
44+
f.write(content + "\n")
45+
print(f'Content added to {filename} Successfully!')
46+
except FileNotFoundError:
47+
print(f"{filename} doesn't exist!")
48+
except Exception as e:
49+
print('An error occurred!')
50+
51+
def main():
52+
while True:
53+
print("\nFILE MANAGEMENT APP")
54+
print('1: Create file')
55+
print('2: View all files')
56+
print('3: Delete file')
57+
print('4: Read file')
58+
print('5: Edit file')
59+
print('6: Exit')
60+
61+
choice = input('Enter your choice (1-6) = ')
62+
63+
if choice == '1':
64+
filename = input("Enter file name to create = ")
65+
create_file(filename)
66+
67+
elif choice == '2':
68+
view_all_file()
69+
70+
elif choice == '3':
71+
filename = input("Enter file name you want to delete = ")
72+
delete_file(filename)
73+
74+
elif choice =='4':
75+
filename = input("Enter file name to read = ")
76+
read_file(filename)
77+
78+
elif choice == '5':
79+
filename = input("Enter file name to edit = ")
80+
edit_file(filename)
81+
82+
elif choice == '6':
83+
print('Closing the app....')
84+
break
85+
86+
else:
87+
print('Invalid choice!')
88+
89+
if __name__ == "__main__":
90+
main()

File Management App/sample.txt

Whitespace-only changes.

Python QRCode project/main.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import qrcode
2+
3+
url = input("Enter the URL here: ").strip()
4+
file_path = "C:\\Users\\iamro\\OneDrive\\Documents\\Desktop\\qrcode.png"
5+
6+
qr = qrcode.QRCode()
7+
qr.add_data(url)
8+
9+
img = qr.make_image()
10+
img.save(file_path)
11+
12+
print("QR Code was generated!")

Tic Tac Toe Game in python/main.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import tkinter as tk
2+
from tkinter import messagebox
3+

0 commit comments

Comments
 (0)