Improve GUI
This commit is contained in:
parent
955cc84cfe
commit
88650ac948
|
@ -1,39 +1,76 @@
|
|||
#!/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
|
||||
|
||||
|
||||
window = Tk()
|
||||
class Pay(Frame):
|
||||
|
||||
title = Label(window, text="Paiement Ḡ1")
|
||||
title.pack()
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
|
||||
# Recipient input
|
||||
recipientEntry = Entry()
|
||||
recipientEntry.pack()
|
||||
self.initUI()
|
||||
|
||||
|
||||
# Amount input
|
||||
AmountEntry = Entry()
|
||||
AmountEntry.pack()
|
||||
def initUI(self):
|
||||
|
||||
# Comment input
|
||||
commentEntry = Entry()
|
||||
commentEntry.pack()
|
||||
self.master.title("Paiement Ḡ1")
|
||||
self.pack(fill=X)
|
||||
|
||||
def ProceedPaiement():
|
||||
recipient = str(recipientEntry.get())
|
||||
amount = int(AmountEntry.get())
|
||||
comment = str(commentEntry.get())
|
||||
print("Paiement en cours ... " + recipient)
|
||||
frame1 = Frame(self)
|
||||
frame1.pack(fill=X)
|
||||
recipientLabel = Label(frame1, text="Destinataire:", width=12)
|
||||
recipientLabel.pack(side=LEFT, padx=5, pady=5)
|
||||
self.recipientEntry = Entry(frame1)
|
||||
self.recipientEntry.pack(fill=X, padx=5, expand=True)
|
||||
|
||||
trans = Transaction(recipient, amount, comment)
|
||||
trans.send()
|
||||
frame2 = Frame(self)
|
||||
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)
|
||||
sendButton.pack()
|
||||
frame4 = Frame(self)
|
||||
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()
|
||||
|
|
Reference in New Issue