forked from PGPagamentos/pdvWindowsPayGoLibC_Python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDialogAddParamWindow.py
109 lines (68 loc) · 2.8 KB
/
DialogAddParamWindow.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
from tkinter import *
from tkinter import ttk
from Enums import *
class DialogAddParamWindow:
def __init__(self, parent,itemsforcombobox,mensagem):
self.bExit = True
top = self.top = Toplevel(parent)
self.ValParam = ''
#labelD.place(relx=0.5, rely=0.5)
Label(top, text=mensagem).place(rely=0.0, relx=0.05)
Label(top, text="Valor do Parametro:").place(rely=0.0, relx=0.65)
###############
self.cb = ttk.Combobox(top,width = 50, values = itemsforcombobox,state="readonly")
#self.cb.current(1)
self.cb.place(rely=0.2, relx=0.05)
self.cb.bind('<<ComboboxSelected>>', self.CurSelect)
self.EntryValParam = Entry(top) # entrada de dados
self.EntryValParam.place(rely=0.2, relx=0.65)
self.EntryValParam.config(width=25)
self.EntryValParam.insert(0,'0')
###############
self.param = ""
b = Button(top, text="OK", command=self.ok)
b.config(width=10)
b.place(rely=0.6, relx=0.45)
######################################################
# centraliza a janela
# Obtem a altura e largura da janela
windowWidth = top.winfo_reqwidth()
windowHeight = top.winfo_reqheight()
print("Width",windowWidth,"Height",windowHeight)
# Obtem a posicao central
positionRight = int(top.winfo_screenwidth()/2 - windowWidth/2)
positionDown = int(top.winfo_screenheight()/2 - windowHeight/2)
# centraliza a janela
#top.geometry("+{}+{}".format(positionRight *2 , positionDown *2))
top.wm_geometry("%dx%d+%d+%d" % (600, 100, positionRight, positionDown))
def ok(self):
self.bExit = False
print ("value is", self.valor)
self.param = self.cb.get()
print(self.EntryValParam.get())
self.ValParam = self.EntryValParam.get()
self.top.destroy()
def CurSelect(self,event):
print("New Element Selected")
print(self.cb.get())
print(self.cb.current())
self.valor = self.cb.get()
print(self.EntryValParam.get())
self.ValParam = self.EntryValParam.get()
############################
# codig para teste
#from tkinter import*
#root=Tk()
#sizex = 300
#sizey = 300
#posx = 20
#posy = 10
#root.wm_geometry("%dx%d+%d+%d" % (sizex, sizey, posx, posy))
#itemsforlistbox=['one','two','three','four','five','six','seven','eight']
#d = DialogAddParamWindow(root,itemsforlistbox,'selecione a opcao:')
#root.wait_window(d.top)
#print(d.param)
#print(d.ValParam)
#print(d.min)
#root.mainloop()
#############################