How to switch between active classes in python
up vote
0
down vote
favorite
I have 4 different classes which need to be accessed trough drop down menu. When 'A' option is selected in drop down menu tkinter should load a class which handles a.db, when 'B', class for b.db and so on.
from tkinter import *
class App(Frame):
def __init__(self, root):
self.root = root
super().__init__(self.root)
self.utility()
return
def utility(self):
options = ['a', 'b', 'c', 'd']
self.menu = StringVar()
self.menu.set('Database')
self.Menu1 = OptionMenu(self, self.menu, *options, command=self.choice)
def choice(self, value):
if value == 'a':
#choose class for a.db
elif value == 'b':
#choose class for b.db
#and so on...
if __name__ == '__main__':
a = App(Tk())
mainloop()
If choice function could manage all classes outside them, that would make my life easier.
database python-3.x tkinter drop-down-menu
add a comment |
up vote
0
down vote
favorite
I have 4 different classes which need to be accessed trough drop down menu. When 'A' option is selected in drop down menu tkinter should load a class which handles a.db, when 'B', class for b.db and so on.
from tkinter import *
class App(Frame):
def __init__(self, root):
self.root = root
super().__init__(self.root)
self.utility()
return
def utility(self):
options = ['a', 'b', 'c', 'd']
self.menu = StringVar()
self.menu.set('Database')
self.Menu1 = OptionMenu(self, self.menu, *options, command=self.choice)
def choice(self, value):
if value == 'a':
#choose class for a.db
elif value == 'b':
#choose class for b.db
#and so on...
if __name__ == '__main__':
a = App(Tk())
mainloop()
If choice function could manage all classes outside them, that would make my life easier.
database python-3.x tkinter drop-down-menu
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have 4 different classes which need to be accessed trough drop down menu. When 'A' option is selected in drop down menu tkinter should load a class which handles a.db, when 'B', class for b.db and so on.
from tkinter import *
class App(Frame):
def __init__(self, root):
self.root = root
super().__init__(self.root)
self.utility()
return
def utility(self):
options = ['a', 'b', 'c', 'd']
self.menu = StringVar()
self.menu.set('Database')
self.Menu1 = OptionMenu(self, self.menu, *options, command=self.choice)
def choice(self, value):
if value == 'a':
#choose class for a.db
elif value == 'b':
#choose class for b.db
#and so on...
if __name__ == '__main__':
a = App(Tk())
mainloop()
If choice function could manage all classes outside them, that would make my life easier.
database python-3.x tkinter drop-down-menu
I have 4 different classes which need to be accessed trough drop down menu. When 'A' option is selected in drop down menu tkinter should load a class which handles a.db, when 'B', class for b.db and so on.
from tkinter import *
class App(Frame):
def __init__(self, root):
self.root = root
super().__init__(self.root)
self.utility()
return
def utility(self):
options = ['a', 'b', 'c', 'd']
self.menu = StringVar()
self.menu.set('Database')
self.Menu1 = OptionMenu(self, self.menu, *options, command=self.choice)
def choice(self, value):
if value == 'a':
#choose class for a.db
elif value == 'b':
#choose class for b.db
#and so on...
if __name__ == '__main__':
a = App(Tk())
mainloop()
If choice function could manage all classes outside them, that would make my life easier.
database python-3.x tkinter drop-down-menu
database python-3.x tkinter drop-down-menu
edited 2 days ago
asked 2 days ago
CodeMonster
104
104
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53266142%2fhow-to-switch-between-active-classes-in-python%23new-answer', 'question_page');
}
);
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password