Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from tkinter import *
- import random
- import time
- import socket
- import tkMessageBox
- class Start (object):
- def __init__(self, balance=0, My_account =1000000):
- self.listaccount = []
- self.registernamelist = []
- self.registerpasswordlist = []
- self.balance = balance
- self.My_account = My_account
- self.root = Tk()
- self.root.title('welcome to the bank')
- self.root.geometry('250x250+250+250')
- self.lebel1 = Label(self.root, text='welcome to the bank', bg='black', fg='green', font=50)
- self.lebel1.pack(
- side=TOP, anchor=CENTER, expand=YES
- )
- self.lebel2 = Label(self.root, text='username:', font=15)
- self.lebel2.pack(
- side=TOP, anchor=CENTER, expand=YES,
- )
- self.entry1 = Entry()
- self.entry1.pack(
- side=TOP, anchor=CENTER, expand=YES,
- )
- self.lebel3 = Label(self.root, text='password:', font=15)
- self.lebel3.pack(
- side=TOP, anchor=CENTER, expand=YES,
- )
- self.entry2 = Entry(self.root, show='*')
- self.entry2.pack(
- side=TOP, anchor=CENTER, expand=YES,
- )
- self.button1 = Button(self.root, text='OK', bg='black', fg='green', command=self.Bruge)
- self.button1.pack(
- side=TOP, anchor=S,
- )
- self.button2 = Button(self.root, text='register', bg='black', fg='green', command=self.Window)
- self.button2.pack(
- side=TOP, anchor='se', expand='YES',
- )
- mainloop()
- def Window(self):
- list = []
- self.GUI2 = Tk()
- self.GUI2.title('welcome to registration of the bank')
- self.GUI2.geometry('300x300')
- self.lebel = Label(self.GUI2, text='please insert your info here ', bg='black', fg='green', font=35)
- self.lebel.pack(
- side=TOP, anchor=CENTER, expand=YES
- )
- self.lebel4 = Label(self.GUI2, text='username or name:', font=15, width=50, height=1)
- self.lebel4.pack(
- side=TOP, anchor=N, expand=YES
- )
- self.enlt1 = Entry(self.GUI2, font=20)
- self.enlt1.pack(
- side=TOP, anchor=N, expand=YES
- )
- self.lebel5 = Label(self.GUI2, text=' insert your password', font=20)
- self.lebel5.pack(
- side=TOP, anchor=N, expand=YES,
- )
- self.lebel6 = Label(self.GUI2, text=' you want to create:', font=20)
- self.lebel6.pack(
- side=TOP, anchor=N, expand=YES
- )
- self.enlt2 = Entry(self.GUI2, font=20, show='*')
- self.enlt2.pack(
- side=TOP, anchor=N, expand=YES,
- )
- self.GUI2.butte2 = Button(self.GUI2, text='OK', fg='green', bg='black' , command=self.Genretore)
- self.GUI2.butte2.pack(
- side=TOP, anchor=N, expand=YES
- )
- mainloop()
- def Genretore(self):
- print (self.enlt1.get())
- print (self.enlt2.get())
- self.registernamelist.append(self.enlt1.get())
- self.registerpasswordlist.append(self.enlt2.get())
- for ff in range(1, 100):
- a = random.randrange(1, 20000)
- namelibl = Label(self.GUI2, text=('this is your username ', self.registernamelist)).pack()
- passwordlibl = Label(self.GUI2, text=('this is your password ', self.registerpasswordlist)).pack()
- lenb = Label(self.GUI2, text=(str('this is your number account '), a)).pack()
- self.listaccount.append(a)
- time.sleep(0.4)
- break
- def Bruge(self):
- print self.registerpasswordlist
- print (self.entry2.get())
- if (self.entry2.get()) == self.registerpasswordlist[0] == (self.entry2.get()):
- if (self.entry1.get()) == self.registernamelist[0] == (self.entry1.get()):
- self.ShopBank()
- elif (self.entry1.get()) != self.registernamelist[0] != (self.entry1.get()):
- tkMessageBox.showerror('error', message='error bad user or password')
- elif (self.entry2.get()) != self.registerpasswordlist[0] != (self.entry2.get()):
- tkMessageBox.showerror('error', message='error bad password')
- else:
- print 'bad way'
- def checkButtns(self, event):
- print 'sss'
- print self.Checklist.bind
- print self.Checklist.insert
- def deposit(self, amount):
- self.My_account += amount
- def withdraw(self, amount):
- self.My_account -= amount
- def ShopBank(self):
- self.Shop = Tk()
- self.Shop.title('welcome to the bank shop!')
- self.Shop.geometry('450x450')
- self.LE1 = Label(self.Shop,font=5,text=('hello user=', self.registernamelist, 'number account=', self.listaccount))
- self.LE1.pack(
- )
- self.LE2 = Label(self.Shop, text='chose what you want to buy', font=20, bg='black', fg='green')
- self.LE2.pack(
- side=TOP, anchor=CENTER
- )
- self.Checklist = Listbox(self.Shop,font=23)
- self.Checklist.insert(0, 'python113')
- self.Checklist.insert(1, 'python251')
- self.Checklist.insert(2, 'python31232')
- self.Checklist.insert(3, 'python462355')
- self.Checklist.insert(4, 'python1235')
- self.Checklist.insert(5, 'python612')
- self.Checklist.bind('<Double-Button-1>',self.checkButtns)
- self.Checklist.pack(
- side=LEFT, anchor=NW
- )
- mainloop()
- b = Start(10000000)
- def ggg():
- b.root
- def main():
- ggg()
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement