Advertisement
Guest User

Untitled

a guest
Feb 18th, 2017
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 5.53 KB | None | 0 0
  1. from tkinter import  *
  2. import random
  3. import time
  4. import socket
  5. import tkMessageBox
  6. class Start (object):
  7.     def __init__(self, balance=0, My_account =1000000):
  8.         self.listaccount = []
  9.         self.registernamelist = []
  10.         self.registerpasswordlist = []
  11.         self.balance = balance
  12.         self.My_account = My_account
  13.         self.root = Tk()
  14.         self.root.title('welcome to the bank')
  15.         self.root.geometry('250x250+250+250')
  16.         self.lebel1 = Label(self.root, text='welcome  to the bank', bg='black', fg='green', font=50)
  17.         self.lebel1.pack(
  18.             side=TOP, anchor=CENTER, expand=YES
  19.         )
  20.         self.lebel2 = Label(self.root, text='username:', font=15)
  21.         self.lebel2.pack(
  22.             side=TOP, anchor=CENTER, expand=YES,
  23.         )
  24.         self.entry1 = Entry()
  25.         self.entry1.pack(
  26.             side=TOP, anchor=CENTER, expand=YES,
  27.         )
  28.         self.lebel3 = Label(self.root, text='password:', font=15)
  29.         self.lebel3.pack(
  30.             side=TOP, anchor=CENTER, expand=YES,
  31.         )
  32.         self.entry2 = Entry(self.root, show='*')
  33.         self.entry2.pack(
  34.             side=TOP, anchor=CENTER, expand=YES,
  35.         )
  36.         self.button1 = Button(self.root, text='OK', bg='black', fg='green', command=self.Bruge)
  37.         self.button1.pack(
  38.             side=TOP, anchor=S,
  39.         )
  40.         self.button2 = Button(self.root, text='register', bg='black', fg='green', command=self.Window)
  41.         self.button2.pack(
  42.             side=TOP, anchor='se', expand='YES',
  43.         )
  44.         mainloop()
  45.     def Window(self):
  46.         list = []
  47.         self.GUI2 = Tk()
  48.         self.GUI2.title('welcome to registration of the bank')
  49.         self.GUI2.geometry('300x300')
  50.         self.lebel = Label(self.GUI2, text='please insert your info here ', bg='black', fg='green', font=35)
  51.         self.lebel.pack(
  52.             side=TOP, anchor=CENTER, expand=YES
  53.         )
  54.         self.lebel4 = Label(self.GUI2, text='username or name:', font=15, width=50, height=1)
  55.         self.lebel4.pack(
  56.             side=TOP, anchor=N, expand=YES
  57.         )
  58.         self.enlt1 = Entry(self.GUI2, font=20)
  59.         self.enlt1.pack(
  60.             side=TOP, anchor=N, expand=YES
  61.         )
  62.         self.lebel5 = Label(self.GUI2, text=' insert your password', font=20)
  63.         self.lebel5.pack(
  64.             side=TOP, anchor=N, expand=YES,
  65.         )
  66.         self.lebel6 = Label(self.GUI2, text=' you want to create:', font=20)
  67.         self.lebel6.pack(
  68.             side=TOP, anchor=N, expand=YES
  69.         )
  70.         self.enlt2 = Entry(self.GUI2, font=20, show='*')
  71.         self.enlt2.pack(
  72.             side=TOP, anchor=N, expand=YES,
  73.         )
  74.         self.GUI2.butte2 = Button(self.GUI2, text='OK', fg='green', bg='black' , command=self.Genretore)
  75.         self.GUI2.butte2.pack(
  76.             side=TOP, anchor=N, expand=YES
  77.         )
  78.         mainloop()
  79.     def Genretore(self):
  80.         print (self.enlt1.get())
  81.         print (self.enlt2.get())
  82.         self.registernamelist.append(self.enlt1.get())
  83.         self.registerpasswordlist.append(self.enlt2.get())
  84.         for ff in range(1, 100):
  85.             a = random.randrange(1, 20000)
  86.             namelibl = Label(self.GUI2, text=('this is your username  ', self.registernamelist)).pack()
  87.             passwordlibl = Label(self.GUI2, text=('this is your password ', self.registerpasswordlist)).pack()
  88.             lenb = Label(self.GUI2, text=(str('this is your number account '), a)).pack()
  89.             self.listaccount.append(a)
  90.             time.sleep(0.4)
  91.             break
  92.  
  93.     def Bruge(self):
  94.         print self.registerpasswordlist
  95.         print (self.entry2.get())
  96.         if (self.entry2.get()) == self.registerpasswordlist[0] == (self.entry2.get()):
  97.             if (self.entry1.get()) == self.registernamelist[0] == (self.entry1.get()):
  98.                 self.ShopBank()
  99.             elif (self.entry1.get()) != self.registernamelist[0] != (self.entry1.get()):
  100.                 tkMessageBox.showerror('error', message='error bad user or password')
  101.         elif (self.entry2.get()) != self.registerpasswordlist[0] != (self.entry2.get()):
  102.             tkMessageBox.showerror('error', message='error bad password')
  103.         else:
  104.             print 'bad way'
  105.  
  106.     def checkButtns(self, event):
  107.         print 'sss'
  108.         print self.Checklist.bind
  109.         print self.Checklist.insert
  110.  
  111.     def deposit(self, amount):
  112.         self.My_account += amount
  113.     def withdraw(self, amount):
  114.         self.My_account -= amount
  115.     def ShopBank(self):
  116.         self.Shop = Tk()
  117.         self.Shop.title('welcome  to the bank shop!')
  118.         self.Shop.geometry('450x450')
  119.         self.LE1 = Label(self.Shop,font=5,text=('hello user=', self.registernamelist, 'number account=', self.listaccount))
  120.         self.LE1.pack(
  121.  
  122.         )
  123.         self.LE2 = Label(self.Shop, text='chose what you want to buy', font=20, bg='black', fg='green')
  124.         self.LE2.pack(
  125.             side=TOP, anchor=CENTER
  126.         )
  127.         self.Checklist = Listbox(self.Shop,font=23)
  128.         self.Checklist.insert(0, 'python113')
  129.         self.Checklist.insert(1, 'python251')
  130.         self.Checklist.insert(2, 'python31232')
  131.         self.Checklist.insert(3, 'python462355')
  132.         self.Checklist.insert(4, 'python1235')
  133.         self.Checklist.insert(5, 'python612')
  134.         self.Checklist.bind('<Double-Button-1>',self.checkButtns)
  135.         self.Checklist.pack(
  136.             side=LEFT, anchor=NW
  137.         )
  138.         mainloop()
  139.  
  140. b = Start(10000000)
  141.  
  142. def ggg():
  143.     b.root
  144. def main():
  145.     ggg()
  146. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement