Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed tkinter and local imports #93

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions organise_desktop/Clean.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,25 @@
from .cronController import schedule_end, schedule_start
from .organiseDesktop import undo, organise_desktop

if sys.version_info >= (3,):
try: # This will throw an error in python 2.x
from tkinter import *
from tkinter import messagebox as tkMessageBox
else:
from tkinter import *
except ImportError:
from Tkinter import *
import tkMessageBox

pwd = os.path.dirname(os.path.abspath(__file__))
Extensions = json.load(open(pwd+'/Extension.json', 'r'))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could probably move these 2 into the class too as class constants

folders = [x for x in Extensions]

class App(Frame):
"""define the GUI"""

def __init__(self, master=None):
Frame.__init__(self, master)
self.pack()
self.create()
self.folders = [x for x in Extensions]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good initiative, but you would need to change all the folders variables to self.folder otherwise it will not use self.folder at all.


def clean(self):
checked_extensions = {}
for x in folders:
Expand Down Expand Up @@ -65,11 +71,6 @@ def create(self):
for key in buttons:
self.make_button(key, buttons[key])

def __init__(self, master=None):
Frame.__init__(self, master)
self.pack()
self.create()

def main():
root = Tk()
# root.resizable = False # commenting this approach and applying the below one.
Expand All @@ -89,4 +90,4 @@ def main():
root.destroy()

if __name__ == '__main__':
main()
main()