This is all the source code for my YouTube Videos on how to make an application or how to create simple programs like notepad, screenshot program, speech converter to text and calculator, and so on.
Please if you like my content Please do not forget to support this channel on PayPal now for $1 only! Or less
Also Subscribe to my YouTube Channel Here if coming from another website
The list of the main source code is here and open them here:
5. Login System With Python Kivy
6. Opening an Image by Calling The Name Of An Image
7. Rename A File By Calling The Name Of The File
8. NotePad Application with Kivy
9. Counter Application with Kivy where you count manually
10. Profit and Loss Calculator Application with Kivy
11. Random Password Generator Kivy
12. Pong Game Kivy
SCREENSHOT APPLICATION KIVY SOURCE CODE
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