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
ttkbootstrapas per the tutorial, which bringsbootstyleparameter, a replacement forstyle.The reason behind the PyCharm warning stands in the way how
ttkbootstrapis designed and implemented. On first glance, thettkbootstrap.Buttonis a class ofttk.Button, and this is what PyCharm sees and utilizes for Warnings about correct/incorrect params. However, during the runtime, theimport ttkbootstrapoverrides the widgets constructors by its ownttkbootstrapgeneric constructor adding thebootstyleparam.The runtime constructor for
ttkbootstrapwidgets: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.