Das Problem besteht darin das wenn ich mehrere Entrys erstelle um die Connection Daten über #entryname.get() kommt nur ein Error:
Hier der Code :Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Python25\lib\lib-tk\Tkinter.py", line 1414, in __call__
return self.func(*args)
File "C:/Dokumente und Einstellungen/Fabian/Desktop/GM TOOL/DBbearbeitung/test.py", line 43, in connected
code1 = db_ask_code1.get()
File "C:\Python25\lib\lib-tk\Tkinter.py", line 2383, in get
return self.tk.call(self._w, 'get')
TclError: invalid command name ".41121592"
Code: Alles auswählen
from Tkinter import *
def platz(main):
absatz = Label(main)
absatz.pack()
def lab(main, infos):
lab_ = Label(main, text=infos)
lab_.pack()
db_ask = Tk()
db_ask.title("Datenbank DATEN")
lab(db_ask, "IP/Hostname")
db_ask_code1=Entry(db_ask, width=25)
db_ask_code1.pack()
lab(db_ask, "Username")
db_ask_code2=Entry(db_ask, width=25)
db_ask_code2.pack()
lab(db_ask, "Passwort")
db_ask_code3=Entry(db_ask, width=25)
db_ask_code3.pack()
platz(db_ask)
lab(db_ask, "Datenbank")
db_ask_code4=Entry(db_ask, width=25)
db_ask_code4.pack()
platz(db_ask)
def connected():
db_ask.destroy()
import MySQLdb
code1 = db_ask_code1.get()
code2 = db_ask_code2.get()
code3 = db_ask_code3.get()
code4 = db_ask_code4.get()
connection = MySQLdb.connect(code1, #error
code2, #error
code3, #error
code4) #error
db_ask_but=Button(db_ask, text="Connecten", command=connected)
db_ask_but.pack()
db_ask.mainloop()