This repository has been archived on 2020-12-03. You can view files and clone it, but cannot push or open issues or pull requests.
py-gva/gui-tkinter.py

77 lines
2.0 KiB
Python
Raw Normal View History

2020-11-15 07:27:51 +01:00
#!/usr/bin/env python3
2020-11-17 06:57:30 +01:00
"""
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
2020-11-17 06:06:45 +01:00
from libs.paylib import Transaction
2020-11-17 03:15:43 +01:00
2020-11-15 07:27:51 +01:00
2020-11-17 06:57:30 +01:00
class Pay(Frame):
def __init__(self):
super().__init__()
self.initUI()
def initUI(self):
self.master.title("Paiement Ḡ1")
self.pack(fill=X)
2020-11-15 07:27:51 +01:00
2020-11-17 06:57:30 +01:00
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)
2020-11-15 07:27:51 +01:00
2020-11-17 06:57:30 +01:00
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)
2020-11-15 09:12:37 +01:00
2020-11-17 06:57:30 +01:00
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)
2020-11-15 09:12:37 +01:00
2020-11-17 06:57:30 +01:00
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)
2020-11-15 07:27:51 +01:00
2020-11-17 06:57:30 +01:00
def ProceedPaiement(self):
recipient = str(self.recipientEntry.get())
amount = int(self.AmountEntry.get())
comment = str(self.commentEntry.get())
print("Paiement en cours ... " + recipient)
2020-11-15 07:27:51 +01:00
2020-11-17 06:57:30 +01:00
trans = Transaction(recipient, amount, comment)
trans.send()
recipient = amount = comment = None
2020-11-15 07:27:51 +01:00
2020-11-17 06:57:30 +01:00
def main():
2020-11-17 06:06:45 +01:00
2020-11-17 06:57:30 +01:00
root = Tk()
root.geometry("300x130+300+300")
app = Pay()
root.mainloop()
2020-11-17 02:48:56 +01:00
2020-11-15 07:27:51 +01:00
2020-11-17 06:57:30 +01:00
if __name__ == '__main__':
main()