I use an IDE for Python called Geany. Normally if you double click on a text file (like .py) then it opens in gedit. Changing this couldn’t be easier, you just right click the file, choose properties and select the desired program from under ‘Opens with’.