-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgraphtest.py
116 lines (91 loc) · 3.48 KB
/
graphtest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
from tkinter import *
from tkinter import ttk
import datetime
import time
class App:
def __init__(self, master=None):
self.defaultFont = ("Arial", "10")
self.firstContainer = Frame(master)
self.firstContainer["pady"] = 10 #desce em 10(px?)
self.firstContainer.pack()
self.secondContainer = Frame(master)
self.secondContainer["padx"] = 20
self.secondContainer.pack()
self.thirdContainer = Frame(master)
self.thirdContainer["padx"] = 20
self.thirdContainer.pack()
self.fourthContainer = Frame(master)
self.fourthContainer['pady'] = 20
self.fourthContainer.pack()
self.fifthContainer = Frame(master)
self.fifthContainer.pack()
self.title = Label(self.firstContainer, text="Dados do Novo Empregado",font=self.defaultFont)
self.title['font'] = ("Arial",'10','bold')
self.title.pack()
self.nameLabel = Label(self.secondContainer,text ='Nome',font=self.defaultFont)
self.nameLabel.pack(side=LEFT)
self.name = Entry(self.secondContainer)
self.name['width'] = 30
self.name['font'] = self.defaultFont
self.name.pack(side=RIGHT)
self.addressLabel = Label(self.thirdContainer, text='Endereço', font=self.defaultFont)
self.addressLabel.pack(side=LEFT)
self.address = Entry(self.thirdContainer)
self.address['width'] = 30
self.address['font'] = self.defaultFont
self.address.pack(side=RIGHT)
self.btnAddEmployee = Button(self.fourthContainer)
self.btnAddEmployee['text'] = 'Adicionar Empregado'
self.btnAddEmployee['font'] = ("Calibri","8")
self.btnAddEmployee['width'] = 20
self.btnAddEmployee['command'] = self.addEmployee
self.btnAddEmployee.pack()
self.msg = Label(self.fourthContainer,text='',font=self.defaultFont)
self.msg.pack()
self.btnCancel = Button(self.fifthContainer, command=self.clearWindow, text='Cancelar',foreground='red')
self.btnCancel.pack(side=RIGHT, padx=20)
def clearWindow(self):
#self.
pass
def addEmployee(self):
name = self.name.get()
address = self.address.get()
if not name == '':
self.msg['text'] = f'{name}, {address}'
else:
self.msg['text'] = 'Dados inválidos.'
class DigitalClock(Toplevel):
def __init__(self,master):
super().__init__(master)
# configure the root window
self.title('Digital Clock')
self.resizable(0, 0)
self.geometry('250x80')
self['bg'] = 'black'
# change the background color to black
self.style = ttk.Style(self)
self.style.configure(
'TLabel',
background='black',
foreground='red')
# label
self.label = ttk.Label(
self,
text=self.time_string(),
font=('Digital-7', 40))
self.label.pack(expand=True)
# schedule an update every 1 second
self.label.after(1000, self.update)
def time_string(self):
return time.strftime('%H:%M:%S')
def update(self):
""" update the label every 1 second """
self.label.configure(text=self.time_string())
# schedule another timer
self.label.after(1000, self.update)
root = Tk()
root.title("Folha de Pagamento")
root.geometry("320x210")
App(root)
clock = DigitalClock(root)
root.mainloop()