from tkinter import *
import tkinter.messagebox
from tkinter import filedialog
from tkinter import ttk
from ttkthemes import themed_tk as tk
import os
root = tk.ThemedTk()
root.get_themes()
root.set_theme("plastik")
# Frames on main window
topframe = Frame(root)
topframe.pack(padx = 10, pady = 10)
nameLable = ttk.Label(topframe, text = "Patient Name")
nameLable.pack(side = LEFT, padx = 5)
patientName = ttk.Entry(topframe, width = 40)
patientName.pack(side = LEFT, padx = 5)
ageLabel = ttk.Label(topframe, text = "Patient Age")
ageLabel.pack(side = LEFT, padx = 5)
patientAge = Entry(topframe)
patientAge.pack(side = LEFT, padx = 5)
genderLabel = ttk.Label(topframe, text = "Select Gender")
genderLabel.pack(side = LEFT, padx = 5)
tkvar = StringVar(root)
choices = {'Select', 'Male', 'Female'}
tkvar.set('Select')
genderMenu = ttk.OptionMenu(topframe, tkvar, *choices)
genderMenu.pack(padx = 5)
leftframe = Frame(root)
leftframe.pack()
left_bottomframe = Frame(leftframe)
left_bottomframe.pack()
rightframe = Frame(root)
rightframe.pack()
right_topframe = Frame(rightframe)
right_topframe.pack()
right_bottomframe = Frame(rightframe)
right_bottomframe.pack()
root.mainloop()
I am new to ttk themes tried to find the issue on google and stack overflow but didn't find the solution. There are some similar issues but not this issue in particular, that is why I am asking this question.
This is the code where the OptionMenu
works just fine in normal case but when it is written as ttk.OptionMenu
the default select option changes randomly.
How to fix this issue?