

Self.current_x, self.current_y = (event.x, event.y) Self.snip_surface.create_rectangle(0, 0, 1, 1, outline='red', width=3, fill="maroon3") Self.start_y = self.snip_surface.canvasy(event.y) Self.start_x = self.snip_surface.canvasx(event.x) Take_bounded_screenshot(self.current_x, self.current_y, self.start_x - self.current_x, self.start_y - self.current_y) Take_bounded_screenshot(self.start_x, self.current_y, self.current_x - self.start_x, self.start_y - self.current_y)Įlif self.start_x >= self.current_x and self.start_y >= self.current_y: If self.start_x = self.current_x and self.start_y = self.current_y: Self.master_screen.attributes("-topmost", True) Self.master_screen.attributes('-fullscreen', True)

Self.snip_surface.bind("", self.on_button_release) Self.snip_surface.bind("", self.on_snip_drag) Self.snip_surface.bind("", self.on_button_press) Self.snip_surface.pack(fill=BOTH, expand=YES) Self.snip_surface = Canvas(self.picture_frame, cursor="cross", bg="grey11") Below is what I see when I type for in the editor (to write the for loop) All snippets seem to be missing.
#PYTHON SNIPPIT CODE#
Self.picture_frame.pack(fill=BOTH, expand=YES) For some unknown reasons, my VS code no longer shows the default code snippets for Python. Self.picture_frame = Frame(self.master_screen, background="maroon3") Self.master_screen.attributes("-transparent", "maroon3") Self.snipButton = Button(self.buttonBar, width=5, height=5, command=self.create_screen_canvas, background="green") nu_frame.pack(fill=BOTH, expand=YES, padx=1, pady=1) Image.save("snips/" + file_name + ".png") Image = pyautogui.screenshot(region=(x1, y1, x2, y2))įile_name = ().strftime("%f") from tkinter import *ĭef take_bounded_screenshot(x1, y1, x2, y2): It will then take a screen shot within the captured coordinates and create + save this time stamped image to a directory called "snips" (feel free to adjust this). When the user releases the snipping box functionality, it will destroy the invisible layer and capture the box coordinates. This will allow the user to see through the invisible drawing layer and provide a surface for drawing the snipping box. I solved this problem by drawing on a transparent layer.
