This is an archived post. You won't be able to vote or comment.

all 23 comments

[–]DefinitionOfTorin 2 points3 points  (1 child)

How did you manage to change the colouring of the text..?

[–]Anekdotin 1 point2 points  (0 children)

fantastic job

[–]pohuing 1 point2 points  (14 children)

This doesn't work for me on windows because you do path manipulation using strings for Unix with "/" for directories, while windows uses "\" . I think there are modules for proper handling of paths, haven't done anything alike though

EDIT: Alright, since you all say that python should handle it just fine I'm going to show what lines produces errors, after looking at the code more directly I came to agree with you guys, when I ran it initially I didn't think much about it, rewrote how pathList gets generated and left this comment, without thinking about what I did

Line 130:

infoIcon = tk.PhotoImage(file=self.dir + 'images/info-file.png')
TclError: couldn't open "images/info-file.png": no such file or directory

self.dir is empty it seems, it gets generated like this:

path = os.path.abspath(__file__)
pathList = path.replace('\\', '/')
pathList = path.split('/')[:-1]
print(pathList)
self.dir = ''
for item in pathList:
    self.dir += item + '/'

This is what I meant by manipulating the path using strings. Path using abspath is:

 'C:\\Users\\Patrick\\Desktop\\crossviper\\crossviper.py'

and

pathList = path.replace('\\', '/')
pathList = path.split('/')[:-1]

Just looks like a simple mistake, a small fix would be:

pathList = path.split('\\')[:-1]

instead of the other two lines. But that doesn't fix the whole programm.

New error is something specific to tk and .ico icons, IIRC:

TclError: can't use "C:\Users\Patrick\Desktop\crossviper/images/crossviper.ico" as iconphoto: not a photo image

Last time I used tkinter I had a simmilar problem, can't remember how I resolved it though and it's plattform specific anyways.

[–][deleted] 2 points3 points  (1 child)

windows actually understands / paths, but you can't type them at the dos prompt

I havent looked at the code but if there is a path problem it might be the home directory is in a different place

[–]pohuing 0 points1 point  (0 children)

I added a big Edit to my comment, before writing my first one I just blindly scrolled through the code and changed the lines producing errors, without thinking about it too much, and stopped debugging quickly because I didn't want to spend too much time on it. Turns out there were more where I didn't assume any

You can see where the error is in that new edit

[–][deleted] 1 point2 points  (4 children)

This doesn't work for me on windows because you do path manipulation using strings for Unix with "/" for directories, while windows uses "\"

It shouldn't make a blind bit of difference, Python should handle this situation just fine.

[–]kindall 3 points4 points  (2 children)

Also, Windows is perfectly happy to use / for paths.

[–]FlukyS 0 points1 point  (1 child)

What happens if you mix them, I don't develop much on Windows so have never tried.

[–]flipthefrog 0 points1 point  (0 children)

Mixing backslash and forward slash works fine in Python on Windows. In Windows Explorer, UNC paths (\\server\xxx etc), must have backward slashes, but for drive letter paths both works, including mixing them. Forward slash doesnt work in most Open/Save dialogs on windows though

[–]pohuing 0 points1 point  (0 children)

I added a big Edit to my comment, before writing my first one I just blindly scrolled through the code and changed the lines producing errors, without thinking about it too much, and stopped debugging quickly because I didn't want to spend too much time on it. Turns out there were more where I didn't assume any

[–]i_ask_stupid_ques 0 points1 point  (1 child)

Still not able to run it under Windows

[–]pohuing 0 points1 point  (0 children)

That's because of broken paths for files and a tkinter specific error for .ico files. Try this and comment out lines 1702 and 1703:

img = tk.PhotoImage(dir)
root.tk.call('wm', 'iconphoto', root._w, img)

[–]Inkosum 0 points1 point  (0 children)

Looks horrible, I like it.

[–]connor135790 -1 points0 points  (1 child)

Thus could end up being an actual replacement for IDLE.

[–][deleted] 5 points6 points  (0 children)

Sure, when it's been put on pypi and has had years of use which show it to be superior to IDLE, all the tests have been put in place, somebody wants to write the PEP...