• Facebook
  • Twitter
  • Reddit
  • StumbleUpon
  • Digg
  • email

from Tkinter import *
import os
import AOCore
 
class AccountsDialog(Toplevel):
    def __init__(self, parent, ao):
        self.data = ao
        self.parent = parent
        Toplevel.__init__(self, parent)
        self.transient(parent)
        self.title("Account Management")
        self.body()
        self.initial_focus = self
        self.grab_set()
        self.initial_focus.focus_set()
        self.wait_window(self)
 
    def ok(self):
        newAccountInfo = []
        newAccountInfo.append(self.accountIDEntry.get())
        newAccountInfo.append(self.labelEntry.get())
        newAccountInfo.append(self.typeEntry.get(self.typeEntry.curselection()))
        self.data.createAccount(newAccountInfo)
        self.destroy()
 
    def body(self):
        Label(self, text = "Account nr: ").grid(row = 0, column = 0)
        Label(self, text = "Label: ").grid(row = 1, column = 0)
        Label(self, text = "Type: ").grid(row = 2, column = 0)
        self.accountIDEntry = Entry(self)
        self.labelEntry = Entry(self)
        self.typeEntry = Listbox(self)
        self.typeEntry.insert(END,"Rabo")
        self.typeEntry.insert(END,"Post")
        self.typeEntry.insert(END,"SNS")
        self.accountIDEntry.grid(row = 0, column = 1)
        self.labelEntry.grid(row = 1, column = 1)
        self.typeEntry.grid(row = 2, column = 1)
        self.b = Button(self, text="OK", command=self.ok, default = ACTIVE)
        self.b.grid(row = 3, column = 1)
        self.bind("<Return>", self.ok)
 
if __name__ == '__main__':
    root = Tk()
    root.title("Account Management")
    ao = AOCore.AOCore(root)
    sd = NewAccountDialog(root, ao)
    root.mainloop()