Skip to content

Commit b607c49

Browse files
author
Osama Yousuf
committed
filename with datetime and icon changed
1 parent ab3d6e7 commit b607c49

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

cut.png

17.7 KB
Loading

snipping.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import pyautogui
44
import webbrowser
55
from tkinter import ttk, messagebox
6+
from datetime import datetime
7+
68

79
class Application():
810
def __init__(self) -> None:
@@ -13,6 +15,9 @@ def __init__(self) -> None:
1315
self.main_window = self.createWindow("Snipping Tool")
1416
self.main_window.config(bg=self.bg)
1517

18+
self.photo = PhotoImage(file = "cut.png")
19+
self.main_window.iconphoto(False, self.photo)
20+
1621
self.title = tk.Label(self.main_window, text="SNIPPING TOOL", font=("HELVETICA",28,"bold"),bg=self.bg,fg=self.fg)
1722
self.title.grid(row=0,column=0,sticky=N,pady=(40,20),padx=40)
1823

@@ -51,8 +56,11 @@ def createWindow(self,title):
5156
return window
5257

5358
def takeBoundedScreenShot(self, x1, y1, x2, y2):
59+
60+
date_time = datetime.now().strftime("%d-%m-%Y-%H-%M-%S")
61+
path = "Capture"+date_time+".png"
5462
im = pyautogui.screenshot(region=(x1, y1, x2, y2))
55-
im.save("Capture.png")
63+
im.save(path+".png")
5664

5765
def snipImage(self):
5866
self.rect = None

0 commit comments

Comments
 (0)