SCREENSHOT APP KIVY!


Please if you like my content Please do not forget to support this channel on PayPal now for $1 only! Or less 


 from kivy.app import App

from kivy.lang.builder import Builder
from kivy.uix.screenmanager import Screen , ScreenManager
import numpy as np
import cv2
import pyautogui
import time

screenmanager = """

ScreenManager:
ScreenshotMenu:


<ScreenshotMenu>:
name: 'menu'
RelativeLayout:
orientation:'vertical'
pos: self.pos
size: root.size

Label:
text: 'Welcome to Screenshot App Kivy!'
pos_hint:{'center_x':0.5, 'center_y':0.905}
font_size: (self.height/15)* 0.75

Label:
text: 'Press The Screenshot Button To ScreenShot The Screen'
pos_hint:{'center_x':0.5, 'center_y':0.705}
font_size: (self.height/15)* 0.65

Label:
text: 'Input The Number Of Seconds'
pos_hint:{'center_x':0.3, 'center_y':0.555}
font_size: (self.height/15)* 0.65

Label:
text: 'Input The Name Of The File'
pos_hint:{'center_x':0.28, 'center_y':0.454}
font_size: (self.height/15)* 0.65

TextInput:
id: seconds
size_hint: 0.08, 0.05
pos_hint:{'center_x':0.59, 'center_y':0.555}
text: '2'

TextInput:
id: screenshotname
size_hint: 0.2, 0.05
pos_hint:{'center_x':0.59, 'center_y':0.454}


Button:
text:'Screenshot'
size_hint: .3, .1
pos_hint:{'center_x':0.47, 'center_y':0.305}
on_release: root.screenshot()






"""

class ScreenshotMenu(Screen):

def screenshot(self):
App.get_running_app().root_window.minimize()
time.sleep(eval(self.ids.seconds.text))

image = pyautogui.screenshot()
image = cv2.cvtColor(np.array(image),cv2.COLOR_RGB2BGR)
cv2.imwrite((self.ids.screenshotname.text + ".png"),image)

App.get_running_app().root_window.restore()





class Screenshot(App):

def build(self):
screen = Builder.load_string(screenmanager)
return screen

sm = ScreenManager()
sm.add_widget(ScreenshotMenu(name='menu'))

Screenshot().run()

No comments:

Post a Comment

Drawing App For Kivy

  Below here is the source code for Drawing Application for kivy. Please if you like this content.  Don't forget to Subscribe to my YouT...