1- #V0.01 .00
1+ #V1.00 .00
22
3- #Importing libraries for SQLite3 conversion
3+ #Importing libraries
44import os
55import sqlite3
66import csv
@@ -85,6 +85,10 @@ def openFile():
8585 Checkbutton (fTable , text = table , variable = var ).grid (row = rowPos , column = 1 , sticky = "W" )
8686 rowPos += 1
8787 updateScrollRegion ()
88+ else : #Clears checklist if an existing database is replaced with an invalid file or no file
89+ checkbox_vars = []
90+ for widget in fTable .winfo_children ():
91+ widget .destroy ()
8892
8993 my_text .configure (state = "disabled" )
9094
@@ -118,6 +122,7 @@ def ConversionWindow():
118122def cancelProcess ():
119123 mainWindow .destroy ()
120124
125+ #Reads the states of the tickboxes in the checkWindow
121126def readStates ():
122127 global tickStates
123128 tickStates = []
@@ -131,8 +136,19 @@ def readStates():
131136
132137mainWindow = Tk () #Opening window for file selection
133138
139+ windowWidth = 1200
140+ windowHeight = 300
141+ checkWidth = 300
142+ checkHeight = windowHeight
143+ screen_width = mainWindow .winfo_screenwidth ()
144+ screen_height = mainWindow .winfo_screenheight ()
145+ windowCornerH = (screen_width - windowWidth - checkWidth )/ 2
146+ windowCornerV = (screen_height - windowHeight )/ 2
147+ checkCornerH = windowCornerH + windowWidth
148+ checkCornerV = windowCornerV
149+
134150#Basic window geometry
135- mainWindow .geometry ('%dx%d+%d+%d' % (1200 , 300 , 400 , 400 ))
151+ mainWindow .geometry ('%dx%d+%d+%d' % (windowWidth , windowHeight , windowCornerH , windowCornerV ))
136152mainWindow .resizable (False , False )
137153mainWindow .title ("SQLite3 Database (*.DB) Conversion Tool" )
138154
@@ -174,8 +190,9 @@ def readStates():
174190#Database table selection window
175191tickWindow = Toplevel (mainWindow )
176192tickWindow .title ("Select tables to export" )
177- tickWindow .geometry ('%dx%d+%d+%d' % (300 , 300 , 1600 , 400 ))
193+ tickWindow .geometry ('%dx%d+%d+%d' % (checkWidth , checkHeight , checkCornerH , checkCornerV ))
178194tickWindow .resizable (False , False )
195+ tickWindow .protocol ("WM_DELETE_WINDOW" , cancelProcess ) #Closes main window when child window is closed
179196
180197cTableContainer = Canvas (tickWindow )
181198fTable = Frame (cTableContainer )
@@ -196,4 +213,4 @@ def createScrollableContainer():
196213createScrollableContainer ()
197214
198215tickWindow .mainloop ()
199- mainWindow .mainloop ()
216+ mainWindow .mainloop ()
0 commit comments