-
-
Save hackerdem/c52ba64acd03afe70550bdd53df8eade to your computer and use it in GitHub Desktop.
test preparation application, needs a excel file of question and answers, application asks one by one
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from tkinter import * | |
import pandas as pd | |
import xdrlib | |
import random | |
from pynput import keyboard | |
from array import array as ar | |
def main(): | |
def startbutton(): | |
label1.text=lis.values[0] | |
root.update_idletasks() | |
def c_list(selection): | |
xl = pd.ExcelFile('C:/Users/erdem/Desktop/Comptia_Network_Plus.xlsx') | |
lis=xl.parse('Sheet'+str(selection)) | |
return lis | |
def valu(): | |
def nextbutton(): | |
selection=var.get() | |
test=a.get() | |
#lis=c_list(selection) | |
#if selection!=a.get():a.set(selection) | |
ls=c_list(selection) | |
if test>=len(ls)-1:a.set(-1) | |
else: | |
a.set(a.get()+1) | |
test=a.get() | |
#d=random.randrange(0, len(ls), step=1, _int=int) | |
text.set(ls.values[test][0]) | |
definition.set(ls.values[test][1]) | |
#root.update_idletasks() | |
text=StringVar() | |
definition=StringVar() | |
Frame2= Frame(root,width=95,height=20,bg="#E1E1E1") | |
label1 = Label(Frame2,width=95,height=5,fg="#6E2C00",bg="#B9B9B9",wraplength=600,font=("Helvetica",18),textvariable=text) | |
label1.pack_propagate(0) | |
label1.pack(fill=BOTH,expand=NO) | |
Frame2.pack_propagate(1) | |
Frame2.pack(fill=X,padx=15,pady=15,expand=NO) | |
label2= Label(Frame2,width=95,height=15,bg="#E1E1E1",fg="#5B2C6F",font=("Helvetica",15),wraplength=600, textvariable=definition) | |
label2.pack(fill=BOTH,expand=NO) | |
Frame1= Frame(root,width=95,height=5,bg="#E1E1E1") | |
B = Button(Frame1,command=startbutton,width=42,height=2,bg="#B9B9B9", text ="Start") | |
B.pack(side=LEFT) | |
f = Button(Frame1,width=42,height=2,bg="#B9B9B9", text ="Exit",command=sys.exit) | |
B.pack(side=LEFT) | |
h = Button(Frame1,command=nextbutton,width=42,height=2,bg="#B9B9B9", text ="Next") | |
h.pack(side=LEFT) | |
f.pack(side=LEFT) | |
Frame1.pack(fill=X,padx=15,pady=15) | |
root=Tk() | |
global lis | |
global selection,test | |
global text,test | |
global definition | |
global var | |
lis=ar('B') | |
var=IntVar() | |
selection=IntVar() | |
test=IntVar() | |
var.set(1) | |
global a | |
a=IntVar() | |
a.set(-1) | |
print (a,selection) | |
PROGRAM_NAME="Network+ Exams" | |
root.title(PROGRAM_NAME) | |
root.config(bg="#808B96") | |
menu_bar=Menu(root) | |
f_menu=Menu(menu_bar,tearoff=0) | |
file_menu=Menu(menu_bar,tearoff=0) | |
for i in range(1,14): | |
f_menu.add_radiobutton(label='Chapter '+str(i),variable=var,value=i,command=valu) | |
file_menu.add_command(label='Import source file') | |
file_menu.add_command(label='Export source file') | |
menu_bar.add_cascade(label='File',menu=file_menu) | |
menu_bar.add_cascade(label='Chapters',menu=f_menu) | |
menu_bar.add_cascade(label='Settings') | |
menu_bar.add_cascade(label='About') | |
root.config(menu=menu_bar) | |
root.geometry("900x600") | |
root.resizable(0,0) | |
global label1 | |
root.mainloop() | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment