Skip to main content

No project description provided

Project description

protk

protk is a library which uses SQL and tkinter to produce an interface.

This project was born of a need to create desktop applications at the law firm I worked at.

Initially, this role was a side-gig focused on producing results quickly rather than working smartly.

Consequently, most of my applications were quick and dirty, especially the interface.

Through constantly expanding my application with new features, it became apparent that the amount of code was going to slow down the load time for the .exe application I created using pyinstaller.

protk is packaged with a sqlite3 .db file. By default, this file is used to create the "demo" interface.

module window

class window(title="Title Unset", menu_on=True, icon=None)

Call window class and set title what you like. If menu_on is False, the menu will be hidden. Icon for the application can be determined by setting icon equal to a path to a .ico file.

module starter

Calls the window class. Starts the application when clicked.

module sqlconnection

Currently, only MySQL and sqlite3 are supported. sqlite3 is the default configuration.

definition sql_flag

The default for sql_flag is "sqlite3". This enables protk to work with the Python standard library. If you desire to use MySQL, set the flag to "mysql". These are the only options supported.

function protk_connection()

The connection function returns a connection to the designated protk database. If using sqlite3, nothing needs to be configured.

If using MySQL, enter your credentials under the mysqlconnection function.

function query(connection=False, _dict=False, options=None)

By default, the result returned is the standard SQL result of the query.

If _dict is set to True, it will return your query as an array of dictionaries. The top-level dictionary's keys are unique integers, the values are dictionaries containing the data you desire. The end result looks like: {1: {"column_1":"data", "column_2":"data"}, 2: {"column_1":"data", "column_2":"data"}}.

If connection is set to False, it establishes the database connection, creates the cursor, executes the query, commits the changes, and closes both the cursor and connection. If you set connection to a mysql or sqlite3 connection object, it will use that connection to create a cursor, execute the query, and close the cursor. You are responsible for committing changes and closing the connection.

function edit(connection=False, options=None)

Similar to query, but no option for _dict.

module dbsetup

Only necessary when setting up MySQL. If configuring MySQL, follow the instructions above, and then run this file. It will install the tables and insert demo data onto the tables. Demo data is taken from the sqlite3 .db file.

module tableconfig

This is where the default table configuration is stored. For now, it's stored in an array. It was derived from an earlier project where a script analyzed the database and applied any changes to it. This will be updated to look "proper" soon.

The Rest of the library

The rest of the library is a collection of modules which either contain tkinter widgets or aid in configuring the widgets. I will be detailing them more thoroughly at a later date.

As they are derived from tkinter, the Effbot Documentation for tkinter is helpful.

MySQL Setup Quick Start:

  1. You'll need to pip install mysql-connector if not already done.
  2. Open protk\sqlconnection
  3. Change sql_flag to "mysql" or change the code around so "mysql" is below "sqlite3".
  4. Locate mysql_connection and enter your credentials for the database you are trying to connect to.

Next Steps:

  1. Map out Menu Items (started)
  2. Create pages for Setup>Interface>Menus and Setup>Interface>Widgets. These pages will allow an end-user to edit the menu and link widgets to the menus.
  3. Build in features from older programs (automated and manual document sorting, case searching, displaying case info)
  4. Fill in the rest of the program to create functional case management software.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for protk, version 1.2
Filename, size File type Python version Upload date Hashes
Filename, size protk-1.2-py3-none-any.whl (2.9 kB) File type Wheel Python version py3 Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page