Tablet Pressure Testing via Python

For questions about using Classic.

Post » Fri Jan 29, 2010 9:00 pm

[quote="KrushBrother":oj1gbjtd]In fact, I've never found a program that doesn't work with the pressure level feature of this tablet, so I don't know what it could be[/quote:oj1gbjtd]

I've never heard of that brand. Maybe it's drivers do something weird and non-standard in order to run the device. It could be that the Python library being used just doesn't support it. I dunno, just a guess.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Fri Jan 29, 2010 9:28 pm

[quote="scidave":jgl7c306]I see what you are getting at with this. Hopefully, there will be a more integrated/automated way though because this is far from straightforward and the changes in a large external library that would have to be made would go really deep.[/quote:jgl7c306]
Sadly this is a python issue. They have the same problem.
So far the solution is to run an unofficial script that reads the libraries, creates dependency data and bundles everything into an .exe, option that is not useful for Construct.
Maybe there's something else, but that's what I could find.
B
3
S
2
G
4
Posts: 1,445
Reputation: 4,665

Post » Sat Jan 30, 2010 12:31 am

[quote="deadeye":17hqkxcl]I've never heard of that brand.[/quote:17hqkxcl]
Really!?

Plenty of different versions over here, from the cheap small ones for kids/hobby use, up to more professional models, and they sit alongside the Wacom ones in the stores.

Maybe Trust aren't in America (although I thought they were American).

Anyway, I still doubt it's the drivers as Scidave gets the same errors without a tablet connected.

We'll see how it goes if Vrav releases another version.

In the meantime, I'm going to look into writing a short Python script outside of Construct to see how well it reads my tablet.

Krush.
B
2
S
2
G
3
Posts: 406
Reputation: 2,062

Post » Sat Jan 30, 2010 12:42 am

[quote="madster":p5tjnzzx]Sadly this is a python issue. They have the same problem.[/quote:p5tjnzzx]

Yeah, I see your point. I was reading more about py2exe to see what insight could be gain from it and they had this link: http://www.py2exe.org/index.cgi/PathModul . That is the same solution, manually changing import names, that we are looking at right now. However, their problem with external libraries is not nearly as bad as Constructs (mostly because it is all Python at first ;-). For example, I was able to easily create a standalone .exe using the AIML libraries. I just can't do the same in Construct (even after lots of renaming).

[quote="madster":p5tjnzzx]So far the solution is to run an unofficial script that reads the libraries, creates dependency data and bundles everything into an .exe, option that is not useful for Construct.[/quote:p5tjnzzx]

That is true that py2exe (or pyinstaller) isn't immediately useful to Construct, but it seems entirely plausible that that functionality could be added to Construct with a lot of effort. However, sadly I personally don't think it is worth the effort considering all of the other bug fixes and updates that could solved with the time. I think I've finally resigned that it just isn't worth it to try to officially support other python libraries. :mrgreen:
B
8
S
3
G
7
Posts: 835
Reputation: 5,313

Post » Sat Jan 30, 2010 12:45 am

[quote="KrushBrother":2cdxrltz][quote="deadeye":2cdxrltz]I've never heard of that brand.[/quote:2cdxrltz]
Really!?

Plenty of different versions over here, from the cheap small ones for kids/hobby use, up to more professional models, and they sit alongside the Wacom ones in the stores.

Maybe Trust aren't in America (although I thought they were American).

Anyway, I still doubt it's the drivers as Scidave gets the same errors without a tablet connected.[/quote:2cdxrltz]

It could be a popular brand here, I don't know. I've just never heard of it :P.

And anyway, what I meant about the errors is that perhaps the Python library just isn't recognizing yout tablet as a tablet, so it's behaving exactly the same way that it would if you didn't have a tablet installed.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Sat Jan 30, 2010 1:09 am

That occurred to me about 5 minutes ago :lol: so I did a check to see what happens when I run it without my pad connected.
I get an error stating line 12 stating that Wintab couldn't find context followed by recurring errors about line 1 and context not being open.
This is probably down to Vrav not bothering to catch the errors in the program.

When the tablet is connected, I get the errors listed above about a list index being out of range.
Having thought about it, this is probably down to what Vrav mentioned earlier about hard-coding it for 1024 pressure levels (I think my tablet is 512).

I'm going to have a look at Wintab and context with Python over the next couple of days.
I doubt I'll ever need to use code for reading the tablet in anything I write, either in Construct or just Python, but it would be nice to get it working, with details written here, for those who might find a use for it in the future.

Vrav, before I go digging for myself, how about a 512 pressure version of what you've got, just to see if that's the problem (and how about some error-trapping ;) )

Krush.
B
2
S
2
G
3
Posts: 406
Reputation: 2,062

Post » Sat Jan 30, 2010 5:44 pm

[quote="KrushBrother":88898bw9]this is probably down to what Vrav mentioned earlier about hard-coding it for 1024 pressure levels (I think my tablet is 512).[/quote:88898bw9]

this sounds very plausible, as python didn't complain about any missing files or definitions
B
3
S
2
G
4
Posts: 1,445
Reputation: 4,665

Post » Sun Jan 31, 2010 5:43 am

Yes, quite seriously, my lack of programming is very likely the cause of any errors. It is essentially a minimal packet request and display from the tablet driver using wintab functions. I am not a programmer, which is why I use Construct... however, I can say the issue of 1024 being hardset on my part only pertains to the height scaling of the pretty orange bar. It may, however, be possible that wintab is unable to create a streaming context with your tablet driver because it, in my minimal test, has not been set up to a) gather information about your tablet and b) configure itself properly in respects to your tablet's capabilities.

This configuration and info gathering I simply have not yet looked into setting up because I don't know what I'm doing in the first place. Rather, I don't know what the code is doing, and therefore do not know how to organize it - it would take a bit of trial and error, be a learning process on my part - and I have been busy with other things. It's possible that 1024-level Wacom tablet compatibility is just the default, unconfigured mode it runs in. I would not yet believe wintab is Wacom-only: isn't this the library GIMP uses? I don't know for sure.

Sorry to have not stayed caught up on this thread. Here's all I had done. Much of the python scripting within the cap is salvaged nigh verbatim from the first in this list of resources. Perhaps you can try running his test python game to see if it functions with your tablet - there are many measures he has included that I first attempted to include, but eventually cut due to not knowing how to structure it in Construct. Evidence of this is in the vestigial var prevpressure, which is defined but never used. I forgot to delete it, haha. [size=85:i84kat9q](Early blind attempt that would cause Construct to crash on the condition of event six.)[/size:i84kat9q]

Scripts and .cap:
http://dl.dropbox.com/u/398143/Files/wi ... essure.zip

Merge the contained Data folder with the one in your Construct install directory. The .cap should be able to access the wintab libraries from there; you need only have Python 26 installed.

Information resources used:
http://www.akeric.com/blog/?p=777
http://cgkit.sourceforge.net/doc2/wintab.html
http://www.wacomeng.com/devsupport/pc.html

In the last link there, there are samples with source code. They seem like they'd be useful for studying the structure of wintab function usage, I have simply not yet gotten into it.

[quote:i84kat9q]I get an error stating line 12 stating that Wintab couldn't find context followed by recurring errors about line 1 and context not being open.[/quote:i84kat9q]
This could be several things. Perhaps wintab cannot find the context it accesses in your tablet drivers... or perhaps the first python scripting module simply cannot find the definition of the context class __init__.py defines. Either would cause the subsequent every-tick module to whine about the context not being open, because it was not opened in the first script module.

In regards to line 12, there is no line 12; I don't know why, but Construct seems to count its script lines from a different angle than they are presented in the script editor, and as such they are often misleading. I checked the scripts and such but they all have open licensing comments through the first twenty or so lines. A better look at what exactly the error pop-up is saying, if it's saying anything more, such as whether it's complaining about an external script, or what, would make it easier to trace.

As for error-trapping, I don't know, I have never really had any problem with forcing a process to end. The errors that do show are generally informative enough.
B
4
S
2
G
6
Posts: 161
Reputation: 2,597

Post » Sun Jan 31, 2010 9:28 pm

hmmm this is probably the culprit
[code:2zy9ahg1]
if packetExtents[1] is not None:[/code:2zy9ahg1]
Now, if packetExtents is empty, that probably means my tablet is not supported or something like that.

dunno. I don't really know python nor Wintab. I just got excited about having support for my tablet :P
B
3
S
2
G
4
Posts: 1,445
Reputation: 4,665

Post » Sun Jan 31, 2010 11:14 pm

Even the line before that, which defines packetExtents - using wintab's "context." If there is no context, it can't access the packets. :<

I'm starting to wonder if there's a different tablet driver for Trust tablets, and then I wonder if it would still work with the wacom drivers installed instead.
B
4
S
2
G
6
Posts: 161
Reputation: 2,597

PreviousNext

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 5 guests