PyQt(+PySide) instant search bar.
- PyQt5 >= 5.8
python -m pip install pyqt-instant-search-bar
Set the visibility of search icon. You can set the text with this function too.
Set the icon. icon should be svg file.
I want to talk about icon size.
Size maybe looks small than preview and in general as well.
So you can change the icon size like this:
lbl = searchBar.getSearchLabel()
lbl.setFixedSize(lbl.size().width() * 2, lbl.size().height() * 2)
Code Sample
from PyQt5.QtWidgets import QApplication
from pyqt_instant_search_bar import InstantSearchBar
if __name__ == "__main__":
import sys
app = QApplication(sys.argv)
searchBar = InstantSearchBar()
searchBar.searched.connect(print) # print the written text
searchBar.show()
app.exec_()
Result
- pyqt-search-bar-menu - QMenu which has search bar as a first item to help you search the menu items.
- pyqt-search-bar - This supports search button. (click to search, not instant search)
- pyqt-database-example - Search the sql database table(using QSqlTableModel) with instant search bar.