python file path

For questions about using Classic.

Post » Mon Aug 22, 2011 12:55 pm

I'm only using python to change the cursor in my game (based on python in this thread)

I want to go to the "data" folder in my app directory.

Currently I have:
sys.path.append(System.AppPath)

How do I rewrite that to go to apppath\data?alspal2011-08-22 12:55:47
B
134
S
65
G
16
Posts: 1,765
Reputation: 19,188

Post » Mon Aug 22, 2011 6:40 pm

It would be:
sys.path.append(System.AppPath + 'data')
B
79
S
24
G
52
Posts: 4,725
Reputation: 39,713

Post » Tue Aug 23, 2011 12:01 am

thank you!
B
134
S
65
G
16
Posts: 1,765
Reputation: 19,188

Post » Tue Aug 23, 2011 6:29 am

I tried doing the same thing for the .ico file is this correct?

From the other thread:

cur=windll.user32.LoadCursorFromFileA(r'C:\WINDOWS\Cursors\banana.ani')

I tried:

cur=windll.user32.LoadCursorFromFileA(System.AppPath + 'data\file.ico')

B
134
S
65
G
16
Posts: 1,765
Reputation: 19,188

Post » Tue Aug 23, 2011 7:48 am

[QUOTE=alspal] I tried doing the same thing for the .ico file is this correct?

From the other thread:

cur=windll.user32.LoadCursorFromFileA(r'C:\WINDOWS\Cursors\banana.ani')

I tried:

cur=windll.user32.LoadCursorFromFileA(System.AppPath + 'data\file.ico')

[/QUOTE]
The "r" in front of the string indicates "raw", which is an instruction for python not to alter the string. Otherwise it is scanned for escape sequences that start with a backslash.
Try
cur=windll.user32.LoadCursorFromFileA(System.AppPath + r'data\file.ico')
or
cur=windll.user32.LoadCursorFromFileA(System.AppPath + 'data\\file.ico')
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Tue Aug 23, 2011 8:22 am

thanks!
B
134
S
65
G
16
Posts: 1,765
Reputation: 19,188


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 5 guests