I try to get the value of the current combobox with a button and display the message. But i do something wrong to take correctly the value selected.
AttributeError: 'SelectDB' object has no attribute 'cmb'
How i do to get the combobox value ?
import sqlite3
from tkinter import *
from tkinter import ttk
from tkinter import messagebox
class SelectDB:
def __init__(self, wind) :
self.wind = wind
self.wind.title ('MyApp')
ttk.Label(self.wind, text="Select you're Database:").grid (row = 0, column = 0)
ttk.Combobox(self.wind, width="10", values=("Local (sqllite)","MYSQL")).grid (row = 0, column = 1)
ttk.Button(text="Start", command=self.checkcmbo).grid (row = 1, column = 0)
def checkcmbo(self):
if self.cmb.get() == "Local (sqllite)":
messagebox.showinfo("What user choose", "you choose Local (sqllite)")
elif self.cmb.get(self) == "MYSQL":
messagebox.showinfo("What user choose", "you choose MYSQL")
else:
messagebox.showinfo("What user choose", "NOTHING")
if __name__ == '__main__':
wind = Tk()
application = SelectDB(wind)
wind.mainloop()