Jump to content
Sign in to follow this  
Wadikjunge

Tkinter Formular

Recommended Posts

Hey, i have some problems with my tkinter formular maybe someone can help me with that.

from tkinter import *



import mysql.connector

providerlist = ["FIVE","BLAU","KLAR","BASE"]

mydb = mysql.connector.connect(
    host="localhost",
    user="root",
    passwd="",
    database="db",
)

#print(mydb)




def load():
    print(provider)
    mycursor = mydb.cursor()


    sql = "INSERT INTO tbl_prepaid(handynummer, provider, euro) VALUES ( "' + str(handynummer.get()) + '","' + providerlist[provider.get()] + '", "' + str(euro.get()) + '" ) "

    print(sql)

    mycursor.execute(sql)

    mydb.commit()



root = Tk()
Label(root, text="Nummer").grid(row=0)
Label(root, text="Wiederholen").grid(row=1)



e1 = Entry(root)
e2 = Entry(root)

e1.grid(row=0, column=1)
e2.grid(row=1, column=1)


v = IntVar()
w = IntVar()

Label(root,
      text="""Wählen sie einen Provider:""",
      justify = LEFT,
      padx = 20).grid(row=2)
Radiobutton(root,
            text="FIVE",
            variable=v,
            value=1).grid(row=3)
Radiobutton(root,
            text="BLAU",
            padx = 20,
            variable=v,
            value=2).grid(row=4)

Radiobutton(root,
            text="KLAR",
            variable=v,
            value=3).grid(row=5)
Radiobutton(root,
            text="BASE",
            variable=v,
            value=4).grid(row=6)

Radiobutton(root,
            text="5",
            variable=w,
            value=5).grid(row=3, column=2)
Radiobutton(root,
            text="10",
            variable=w,
            value=6).grid(row=4, column=2)

Radiobutton(root,
            text="15",
            variable=w,
            value=7).grid(row=5, column=2)

Button(root, text="Abschicken", command=load ).grid(row=6, column=2)

mainloop()


this is how far i came

thank you for trying to help!

Share this post


Link to post
Share on other sites

Hi there, and welcome to the forums!

The only issue I've run into with your code is that provider isn't defined. I can't be sure that's defined in mysql as I removed that module from the code.

What are you trying to make happen, and what's actually happening in this code?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...