Class project made in Python3 with Tkinter.
We were asked to create any kind of software with at least:
- 3 logical instructions,
- 3 graphical elements,
- Communication with anything in any manner (network, COM port, ...).
We thought it would be fun to create a graphical interface for difflib.unified_diff(f1, f2, lineterm=nl) (returns diff line-by-line between two files in an array).
getIP()called only on start to print IP onbottomBar, returns the main IP of the computer,DiffWindowcontains most functions of the software,__init__()has the window,DiffWindow.fileSelctMaster()shows a file selector for the master file,DiffWindow.fileSlctSlave()shows a file selector for the slave file,DiffWindow.whereAmI()is called everytime user clicks ondiffBox(big text box), returns where the user just clicked on the screen,DiffWindow.connect()is called whenever user clicks onconnectBtn, tellssocketto connect on whatever is entered inipEntryon port42000,DiffWindow.changeDiffBox(text), as I disablediffBox, we cannot tell a function to just write into it, we have to enable it, writetextand disable it again,DiffWindow.diffServer(), starts a server on port42000so another window can connect to it and send content,DiffWindow.calcDiff(), puts a multi line string of the diff betweenf1andf2indiffBox,DiffWindow.errorHandler(func), is called to handle errors, and does it in a very simple way: just prints in amessagebox.
Whenever DiffWindow is called, a Tkinter window is created, and another thread for DiffWindow.diffServer() is started by it, opening port 42000.
Windows: Communication works only when you start TkDiff as admin