-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgenerate.py
273 lines (227 loc) · 7.9 KB
/
generate.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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
from tkinter import ttk
def btn_clicked():
print('HI')
class Generate(ttk.Frame):
def select_path(self, event):
self.output_path = str
# window.withdraw()
self.output_path = filedialog.askdirectory(title= ' Répertoire de sortie')
self.entry3.delete(0, END)
self.entry3.insert(0, self.output_path)
def select_file(self, event):
self.file_path = str
self.file_path = filedialog.askopenfilename(title = "Select file",filetypes = (("MS Excel","*.xlsx"),))
self.entry4.delete(0, END)
self.entry4.insert(0, self.file_path)
def quitf(self):
self.quit()
def btn_clicked(self):
print('Hi')
def __init__(self, container):
super().__init__(container)
self.container = container
self.canvas = Canvas(
bg="#ffffff",
height=500,
width=800,
bd=0,
highlightthickness=0,
relief="ridge")
self.canvas.place(x=0, y=0)
self.chap_cb = BooleanVar()
self.entry0_img = PhotoImage(file=f"./src/generate/img_textBox0.png")
entry0_bg = self.canvas.create_image(
236.0, 214.5,
image=self.entry0_img)
self.entry0 = Entry(
bd=0,
bg="#eeeeee",
font='Calibri 14',
highlightthickness=0)
self.entry0.place(
x=102.5240249633789, y=196,
width=266.9519500732422,
height=35)
self.entry1_img = PhotoImage(file=f"./src/generate/img_textBox1.png")
entry1_bg = self.canvas.create_image(
570.0, 215.5,
image=self.entry1_img)
self.entry1 = Entry(
bd=0,
font='Calibri 14',
bg="#eeeeee",
highlightthickness=0)
self.entry1.place(
x=436.5240249633789, y=197,
width=266.9519500732422,
height=35)
self.entry2_img = PhotoImage(file=f"./src/generate/img_textBox2.png")
entry2_bg = self.canvas.create_image(
237.0, 288.0,
image=self.entry2_img)
self.entry2 = Entry(
bd=0,
font='Calibri 14',
bg="#eeeeee",
highlightthickness=0)
self.entry2.place(
x=103.5240249633789, y=270,
width=266.9519500732422,
height=34)
self.entry3_img = PhotoImage(file=f"./src/generate/img_textBox3.png")
entry3_bg = self.canvas.create_image(
236.0, 361.0,
image=self.entry3_img)
self.entry3 = Entry(
bd=0,
font='Calibri 14',
bg="#eeeeee",
highlightthickness=0)
self.entry3.bind("<1>", self.select_path)
self.entry3.place(
x=102.5240249633789, y=343,
width=266.9519500732422,
height=34)
self.entry4_img = PhotoImage(file=f"./src/generate/img_textBox4.png")
entry4_bg = self.canvas.create_image(
571.0, 288.5,
image=self.entry4_img)
self.entry4 = Entry(
bd=0,
font='Calibri 14',
bg="#eeeeee",
highlightthickness=0)
self.entry4.bind("<1>", self.select_file)
self.entry4.place(
x=437.5240249633789, y=270,
width=266.9519500732422,
height=35)
self.canvas.create_text(
220, 175,
text="Nombre de questions (5 - 20)",
fill="#000000",
font=("Kanit Light", 15))
self.canvas.create_text(
532, 175,
text="Nombre de choix (3 - 5)",
fill="#000000",
font=("Kanit Light", 15))
self.canvas.create_text(
170.0, 252.0,
text="Langue (fr ou ar)",
fill="#000000",
font=("Kanit Light", 16))
self.canvas.create_text(
485.0, 252.5,
text="Fichier Excel",
fill="#000000",
font=("Kanit Light", 16))
self.canvas.create_text(
185, 324.0,
text="Répertoire de sortie",
fill="#000000",
font=("Kanit Light", 16))
self.canvas.create_text(
709, 356,
text="Ajouter des unités",
fill="#000000",
font=("Kanit Light", 11))
self.canvas.create_text(
402.0, 115,
text="générer les feuilles d'examen",
fill="#000000",
font=("Kanit Regular", 24))
"""self.canvas.create_text(
402.0, 138,
text="un moyen rapide et efficace pour générer les feuilles d'examen",
fill="#4b4a4a",
font=("Lato SemiBold", 14))"""
self.img0 = PhotoImage(file=f"./src/generate/img0.png")
b0 = Button(
image=self.img0,
borderwidth=0,
highlightthickness=0,
command=lambda: container.show_frame(Home,None,None,None,None,None),
relief="flat")
b0.place(
x=65, y=27,
width=167,
height=40)
self.img1 = PhotoImage(file=f"./src/generate/img1.png")
b1 = Button(
image=self.img1,
borderwidth=0,
highlightthickness=0,
command=self.gen_button,
relief="flat")
b1.place(
x=426, y=340,
width=166,
height=41)
self.img2 = PhotoImage(file=f"./src/generate/img2.png")
b2 = Button(
image=self.img2,
borderwidth=0,
highlightthickness=0,
command=lambda: container.show_frame(Home,None,None,None,None,None),
relief="flat")
b2.place(
x=636, y=33,
width=25,
height=25)
self.img3 = PhotoImage(file=f"./src/generate/img3.png")
b3 = Button(
image=self.img3,
borderwidth=0,
highlightthickness=0,
command=lambda: container.show_frame(Correct,None,None,None,None,None),
relief="flat")
b3.place(
x=672, y=33,
width=25,
height=25)
self.img4 = PhotoImage(file=f"./src/generate/img4.png")
b4 = Button(
image=self.img4,
borderwidth=0,
highlightthickness=0,
command=self.quitf,
relief="flat")
b4.place(
x=709, y=33,
width=25,
height=25)
self.img5 = PhotoImage(file=f"./src/generate/img5.png")
b5 = Button(
image=self.img5,
borderwidth=0,
highlightthickness=0,
command=btn_clicked,
relief="flat")
b5.place(
x=90, y=413,
width=624,
height=59)
self.cbu1 = Checkbutton(self.canvas, variable=self.chap_cb, bg='#00766F', onvalue=True, offvalue=False)
self.cbu1.place(x=607, y=347)
def gen_button(self):
self.question = int(self.entry0.get())
self.choice = int(self.entry1.get())
self.lang = str(self.entry2.get())
self.excel = str(self.entry4.get())
self.output = str(self.entry3.get())
if self.chap_cb.get() == False:
messagebox.showinfo(title="Veuillez patienter",
message="La tâche est en cours de traitement")
gen.generateExam(self.question, self.choice, self.excel, self.lang, self.output, None, None, None, 0)
messagebox.showinfo(title='succès',
message='tâche accomplie avec succès')
elif self.chap_cb.get() == True:
self.container.show_frame(Chapters, self.question, self.choice, self.excel, self.lang,
self.output)
from home import Home
from chapters import Chapters
from correct import Correct
import generateExam as gen
from tkinter import *
from tkinter import filedialog, messagebox