├── README.md ├── paint1.py ├── pass.py └── turtle4.py /README.md: -------------------------------------------------------------------------------- 1 | # python-password-master 2 | this app is an example of a password to other app 3 | run first pass.py 4 | thanks for using my code :) <3 5 | you will need this libraries: 6 | turtle 7 | tkinter 8 | subprocess 9 | -------------------------------------------------------------------------------- /paint1.py: -------------------------------------------------------------------------------- 1 | from tkinter import * 2 | from tkinter import ttk, colorchooser 3 | 4 | class main: 5 | def __init__(self,master): 6 | self.master = master 7 | self.color_fg = 'black' 8 | self.color_bg = 'white' 9 | self.old_x = None 10 | self.old_y = None 11 | self.penwidth = 5 12 | self.drawWidgets() 13 | self.c.bind('',self.paint)#drwaing the line 14 | self.c.bind('',self.reset) 15 | 16 | def paint(self,e): 17 | if self.old_x and self.old_y: 18 | self.c.create_line(self.old_x,self.old_y,e.x,e.y,width=self.penwidth,fill=self.color_fg,capstyle=ROUND,smooth=True) 19 | 20 | self.old_x = e.x 21 | self.old_y = e.y 22 | 23 | def reset(self,e): #reseting or cleaning the canvas 24 | self.old_x = None 25 | self.old_y = None 26 | 27 | def changeW(self,e): #change Width of pen through slider 28 | self.penwidth = e 29 | 30 | 31 | def clear(self): 32 | self.c.delete(ALL) 33 | 34 | def change_fg(self): #changing the pen color 35 | self.color_fg=colorchooser.askcolor(color=self.color_fg)[1] 36 | 37 | def change_bg(self): #changing the background color canvas 38 | self.color_bg=colorchooser.askcolor(color=self.color_bg)[1] 39 | self.c['bg'] = self.color_bg 40 | 41 | def drawWidgets(self): 42 | self.controls = Frame(self.master,padx = 5,pady = 5) 43 | Label(self.controls, text='Pen Width:',font=('arial 18')).grid(row=0,column=0) 44 | self.slider = ttk.Scale(self.controls,from_= 5, to = 100,command=self.changeW,orient=VERTICAL) 45 | self.slider.set(self.penwidth) 46 | self.slider.grid(row=0,column=1,ipadx=30) 47 | self.controls.pack(side=LEFT) 48 | 49 | self.c = Canvas(self.master,width=500,height=400,bg=self.color_bg,) 50 | self.c.pack(fill=BOTH,expand=True) 51 | 52 | menu = Menu(self.master) 53 | self.master.config(menu=menu) 54 | filemenu = Menu(menu) 55 | colormenu = Menu(menu) 56 | menu.add_cascade(label='Colors',menu=colormenu) 57 | colormenu.add_command(label='Brush Color',command=self.change_fg) 58 | colormenu.add_command(label='Background Color',command=self.change_bg) 59 | optionmenu = Menu(menu) 60 | menu.add_cascade(label='Options',menu=optionmenu) 61 | optionmenu.add_command(label='Clear Canvas',command=self.clear) 62 | optionmenu.add_command(label='Exit',command=self.master.destroy) 63 | 64 | 65 | 66 | if __name__ == '__main__': 67 | root = Tk() 68 | main(root) 69 | root.title('Application') 70 | root.mainloop() -------------------------------------------------------------------------------- /pass.py: -------------------------------------------------------------------------------- 1 | from tkinter import * 2 | from subprocess import call 3 | import tkinter 4 | root = Tk() 5 | username = "free_user" #that's the given username 6 | password = "123" #that's the given password 7 | 8 | #username entry 9 | username_entry = Entry(root) 10 | username_entry.pack() 11 | 12 | #password entry 13 | password_entry = Entry(root, show='*') 14 | password_entry.pack() 15 | 16 | def trylogin(): #this method is called when the button is pressed 17 | #to get what's written inside the entries, I use get() 18 | #check if both username and password in the entries are same of the given ones 19 | if username == username_entry.get() and password == password_entry.get(): 20 | print("Correct") 21 | call(["python", "paint1.py"]) 22 | else: 23 | print("Wrong") 24 | print("get the password here: https://pastebin.com/QnJSKyDB") 25 | 26 | #when you press this button, trylogin is called 27 | button = Button(root, text="check", command = trylogin) 28 | button.pack() 29 | 30 | #App starter 31 | root.mainloop() -------------------------------------------------------------------------------- /turtle4.py: -------------------------------------------------------------------------------- 1 | # importing package 2 | from multiprocessing.connection import wait 3 | 4 | import turtle 5 | turtle.color('red', 'yellow') 6 | turtle.pensize(5) 7 | # method to call on drag 8 | wn = turtle.Screen() 9 | def fxn(x, y): 10 | turtle.penup() 11 | turtle.goto(x, y) 12 | turtle.color('red', 'green') 13 | turtle.pendown() 14 | turtle.begin_fill() 15 | 16 | wn.onclick(fxn) 17 | def fxn1(x, y): 18 | 19 | # stop backtracking 20 | turtle.ondrag(None) 21 | 22 | # move the turtle's angle and direction 23 | # towards x and y 24 | turtle.setheading(turtle.towards(x, y)) 25 | 26 | # go to x, y 27 | turtle.goto(x, y) 28 | turtle.color('red', 'yellow') 29 | 30 | 31 | # call again 32 | turtle.ondrag(fxn1) 33 | 34 | # set turtle speed 35 | turtle.speed(15) 36 | 37 | # make turtle screen object 38 | sc = turtle.Screen() 39 | 40 | # set screen size 41 | sc.setup(1920, 1080) 42 | 43 | # call fxn on drag 44 | turtle.ondrag(fxn1) 45 | 46 | # take screen in mainloop 47 | sc.mainloop() --------------------------------------------------------------------------------