0

i dont know why i cannot put all of my code i created a function w3 and i add some checkbuttons the problem is that if the user clicks "< Υποβολή >" the function listokouti only recognizes the messagebox and its like i never put elif,can anyone help?

    i1=IntVar()
    i2=IntVar()
    i3=IntVar()
    i4=IntVar()
    i5=IntVar()
    #i6=IntVar()
    #i7=IntVar()

    # checkbuttons

    check1 = tk.Checkbutton(rain,text="Τίτλος",font=('',13),variable=i1,onvalue=1,offvalue=0).pack(expand=1,anchor="nw")
    check2 = tk.Checkbutton(rain,text="Tίτλος(Μετάφραση)",font=('',13),variable=i2,onvalue=1,offvalue=0).pack(expand=1,anchor="nw")
    check3 = tk.Checkbutton(rain,text="Συγγραφέας",font=('',13),variable=i3,onvalue=1,offvalue=0).pack(expand=1,anchor="nw")
    check4 = tk.Checkbutton(rain,text="Λέξεις κλειδιά",font=('',13),variable=i4,onvalue=1,offvalue=0).pack(expand=1,anchor="nw")
    check5 = tk.Checkbutton(rain,text="Λέξεις κλειδιά(Μετάφραση)",font=('',13),variable=i5,onvalue=1,offvalue=0).pack(expand=1,anchor="nw")
                            
    def listokouti():
        if i1.get()==0 and i2.get()==0 and i3.get()==0 and i4.get()==0 and i5.get()==0 :  
            vsause=messagebox.showwarning("team.33","Παρακαλώ επιλέξτε φίλτρα")

        elif i1.get()==1 or i2.get()==1 or i3.get()==1 or i4.get()==1 or i5.get()==1 :
            money=tk.Tk()
            money.title("team.33")
            money.iconbitmap('C:\Program Files (x86)\icon.ico')
            # money.config(bg="#000000")
            frame=tk.Frame(money)
            scrollarw1=ttk.Scrollbar(frame,orient=VERTICAL)
            my_listbox= tk.Listbox(frame,yscrollcommand=scrollarw1.set,width=50)
            scrollarw1.config(command=my_listbox.yview)
            scrollarw1.pack(side=RIGHT,fill= Y)
            scrollarw2=ttk.Scrollbar(frame,orient=HORIZONTAL)
            scrollarw2.config(command=my_listbox.xview)
            scrollarw2.pack(side=BOTTOM,fill= X)
            frame.pack()
            my_listbox.pack(pady=20)
            # to item einai akyro to evala mono gia na leitoyrgei to scrollbar
            for item in range(1,101):
                my_listbox.insert(END,item)
            butt =tk.Button(money,text="< Υποβολή >",font=("",10,'bold'),command=ergasia).pack()
            money.mainloop()


    b1 = tk.Button(rain,text="< Υποβολή >",font=("",10,"bold"),command= listokouti).pack(expand=1)

    rain.mainloop()

w3()

001
  • 13,291
  • 5
  • 35
  • 66
ele
  • 1
  • [What's the difference between tkinter's Tk and Toplevel classes?](https://stackoverflow.com/q/29655219) – 001 Jan 12 '22 at 18:49
  • Your code works perfectly for me, once I added `rain=tk.Tk()` at the top. Note that you don't really need that `elif...:`; you can just say `else:`. – Tim Roberts Jan 12 '22 at 18:50
  • is it a problem if i have this function in another function which is already in another function?? – ele Jan 12 '22 at 19:24

0 Answers0