RANDOM PASSWORD GENERATOR 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.properties import StringProperty
from kivy.lang.builder import Builder
from kivy.uix.screenmanager import Screen, ScreenManager
import random
import string

screenmanager = """

ScreenManager:
MainScreen:


<MainScreen>:
name: 'main'
RelativeLayout:
orientation: 'vertical'
pos: self.pos

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


Label:
text:'Enter Number Of Character!'
pos_hint:{'center_x':0.3, 'center_y': 0.705}
font_size: (self.height/15)* 0.65


TextInput
id: characters
size_hint: 0.1, 0.05
pos_hint:{'center_x':0.56, 'center_y': 0.705}
text:root.profit




Button:
text: 'Generate'
size_hint: .3, .1
pos_hint:{'center_x':0.47, 'center_y': 0.505}
on_press: root.generate()

TextInput:
text: ''
id: answer
pos_hint:{'center_x':0.47, 'center_y': 0.305}
size_hint: 0.3, 0.15








"""


class Pal(App):

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


class MainScreen(Screen):
profit = StringProperty('0')
loss = StringProperty('0')

def generate(self):
try:
letters = string.ascii_lowercase + string.ascii_uppercase + string.punctuation + string.digits

password = "".join(random.sample(letters, k=int(self.ids.characters.text)))

answer = self.ids.answer.text = str('Your new password is ') + str(password)


except ValueError:
answer = self.ids.answer.text = str('Invalid Value!')


sm = ScreenManager()
sm.add_widget(MainScreen(name='main'))

Pal().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...