Improve GUI

This commit is contained in:
poka 2020-11-17 06:57:30 +01:00
parent 955cc84cfe
commit 88650ac948
1 changed files with 61 additions and 24 deletions

View File

@ -1,39 +1,76 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
from tkinter import Tk, Label, Entry, Button """
ZetCode Tkinter tutorial
In this example, we use the pack
manager to create a review example.
Author: Jan Bodnar
Website: www.zetcode.com
"""
from tkinter import Tk, Text, TOP, BOTH, X, N, LEFT
from tkinter.ttk import Frame, Label, Entry, Button
from libs.paylib import Transaction from libs.paylib import Transaction
window = Tk() class Pay(Frame):
title = Label(window, text="Paiement Ḡ1") def __init__(self):
title.pack() super().__init__()
# Recipient input self.initUI()
recipientEntry = Entry()
recipientEntry.pack()
# Amount input def initUI(self):
AmountEntry = Entry()
AmountEntry.pack()
# Comment input self.master.title("Paiement Ḡ1")
commentEntry = Entry() self.pack(fill=X)
commentEntry.pack()
def ProceedPaiement(): frame1 = Frame(self)
recipient = str(recipientEntry.get()) frame1.pack(fill=X)
amount = int(AmountEntry.get()) recipientLabel = Label(frame1, text="Destinataire:", width=12)
comment = str(commentEntry.get()) recipientLabel.pack(side=LEFT, padx=5, pady=5)
print("Paiement en cours ... " + recipient) self.recipientEntry = Entry(frame1)
self.recipientEntry.pack(fill=X, padx=5, expand=True)
trans = Transaction(recipient, amount, comment) frame2 = Frame(self)
trans.send() frame2.pack(fill=X)
AmountLabel = Label(frame2, text="Montant:", width=12)
AmountLabel.pack(side=LEFT, padx=5, pady=5)
self.AmountEntry = Entry(frame2)
self.AmountEntry.pack(fill=X, padx=5, expand=True)
recipient = amount = comment = None frame3 = Frame(self)
frame3.pack(fill=X)
commentLabel = Label(frame3, text="Commentaire:", width=12)
commentLabel.pack(side=LEFT, padx=5, pady=5)
self.commentEntry = Entry(frame3)
self.commentEntry.pack(fill=X, padx=5, expand=True)
sendButton = Button(window, text="Envoyer", command=ProceedPaiement) frame4 = Frame(self)
sendButton.pack() frame4.pack()
self.sendButton = Button(frame4, text="Envoyer", command=self.ProceedPaiement)
self.sendButton.pack(side=LEFT, padx=5, pady=5, expand=True)
window.mainloop() def ProceedPaiement(self):
recipient = str(self.recipientEntry.get())
amount = int(self.AmountEntry.get())
comment = str(self.commentEntry.get())
print("Paiement en cours ... " + recipient)
trans = Transaction(recipient, amount, comment)
trans.send()
recipient = amount = comment = None
def main():
root = Tk()
root.geometry("300x130+300+300")
app = Pay()
root.mainloop()
if __name__ == '__main__':
main()