Tablet Pressure Testing via Python

This forum is currently in read-only mode.
From the Asset Store
Forget about default textbox restrictions, you can create sprites atop of the textbox
  • Mine's a Wacom Graphire, model CTE-430.

    And as previously mentioned, your test works fine. I do have vanilla Python installed, but no other libraries.

  • The test works perfectly for me using a Wacom Instuos3 A4.

  • I don't have a tablet, but I was assuming based on an earlier post that this would work fine without one.

    Also, I don't have Python installed.

  • What tablets do you guys own (if any)?

    I use the Trust TB-4200 A4 work area (http://www.trust.com/products/product.aspx?artnr=14070)

    Works fine with Photoshop, using pressure levels for thickness/fade/colour etc.

    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.

    Probably nothing to do with the tablet, and will end up being something else system specific.

    Scidave's post about not having a tablet suggests this.

    BTW, I do have a Python environment installed, which is used regularly outside of Construct(I must get around to using it more in Construct).

    Krush.

  • 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

    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.

  • 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.

    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.

  • I've never heard of that brand.

    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.

  • Sadly this is a python issue. They have the same problem.

    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).

    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.

    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.

  • > I've never heard of that brand.

    >

    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.

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

    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.

  • That occurred to me about 5 minutes ago 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.

  • this is probably down to what Vrav mentioned earlier about hard-coding it for 1024 pressure levels (I think my tablet is 512).

    this sounds very plausible, as python didn't complain about any missing files or definitions

  • 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.

    (

    Early blind attempt that would cause Construct to crash on the condition of event six.)

    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.

    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.

  • hmmm this is probably the culprit

    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
  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • my tablet didn't get a context failure error, but an array out of bounds error.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)