I got an "Unexpected argument" warning in PyCharm when using the ttkbootstrap's bootstyle argument.
The following code works but I couldn't fix the warning.
import ttkbootstrap as ttk
from ttkbootstrap.constants import *
root = ttk.Window()
b1 = ttk.Button(root, text="Button 1", bootstyle=SUCCESS)
b1.pack(side=LEFT, padx=5, pady=10)
b2 = ttk.Button(root, text="Button 2", bootstyle=(INFO, OUTLINE))
b2.pack(side=LEFT, padx=5, pady=10)
root.mainloop()
Use style instead like so. No warning in pycharm and works like a charm:
However, this is not a recommended use of
ttkbootstrap
as per the tutorial, which bringsbootstyle
parameter, a replacement forstyle
.The reason behind the PyCharm warning stands in the way how
ttkbootstrap
is designed and implemented. On first glance, thettkbootstrap.Button
is a class ofttk.Button
, and this is what PyCharm sees and utilizes for Warnings about correct/incorrect params. However, during the runtime, theimport ttkbootstrap
overrides the widgets constructors by its ownttkbootstrap
generic constructor adding thebootstyle
param.The runtime constructor for
ttkbootstrap
widgets:The style/bootstyle are both used.
While one could argue this implementation is elegant in my opinion it brings confusion and makes IDEs such as PyCharm trigger false Warnings.