Tkinter widgets for desktop database application

Betty Hollinshead lizzyhollins99 at gmail.com
Wed Jul 14 09:20:04 EDT 2021


On Tuesday, 13 July 2021 at 21:35:01 UTC+1, Rich Shepard wrote:
> I'm writing a couple of database applications that use tkinter, and not a 
> web browser, for the UI and I'm still trying to determine the optimal way to 
> do this. 
> 
> Individual tk and ttk widgets (LineEntry, Combobox, etc.) work for adding 
> and modifying individual database table rows but not for displaying multiple 
> rows returned by a SELECT statement. To view all rows returned by the SQL 
> statement would a pythonReport be used? 
> 
> I'm working on learning to use tksheet as the sole widget because it can 
> display multiple rows from a database table as well as add new rows and 
> modify existing ones (one or more columns in each row). 
> 
> What have other developers used for the UI on a stand-alone database 
> application not using a web browser? I've struggled with finding the most 
> efficient and optimal non-brower UI for months and would like to have a 
> solid path toward a working solution. I know too little to make this 
> decision and want advice, suggestions, and recommendations from experienced 
> developers. 
> 
> TIA, 
> 
> Rich

So.....I've had success with GTK3 (not Tkinter).  Steps involve a non-Pythonic start:
1.  Design your GUI with Glade.  It's a GUI design tool for GUIs!  Output is an XML definition tool
      which you import into your Python program.
      To your point about multiple lines, see the GTK TextView widget.
2.   In Python:
               from gi.repository import GObject, Gio, Gdk, Gtk
               ...
               builder = Gtk.Builder.new_from_file("mainwin.xml")
               builder.connect_signals(self)
               .....
               self.MainWindow1 = builder.get_object("window")
               ......
               ......and the other GUI definitions from Glade/XML
               .......and so on......I've used this basic structure with the Python3 interface to SQLITE3 with success.

Sorry about the paucity of the example.....it's a big subject....but there's lots of help out there!
L.


More information about the Python-list mailing list