[Tutor] Convert Qstring to string in windows

2014-10-16 Thread C@rlos

I have been tryed to convert a Qstring text to string on python, in linux that 
work fine but in windows when qstring contine á,é,í,ó,ú the converted text is 
not correct, contine extranger characters, 
this qstring text is an url from qdialogtext. 

in linux i do for this way: 
pythonstringtext=qstringtext.text().toUtf8.data() 
and it return a python string correctly. 

i need some help plese... 

.C@rlos 


III Escuela Internacional de Invierno en la UCI del 17 al 28 de febrero del 
2014. Ver www.uci.cu

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Convert Qstring to string in windows

2014-10-16 Thread Danny Yoo
On Thu, Oct 16, 2014 at 8:21 AM, C@rlos  wrote:
>
> I have been tryed to convert a Qstring text to string on python, in linux
> that work fine but in windows when qstring contine á,é,í,ó,ú the converted
> text is not correct, contine extranger characters,
> this qstring text is an url from qdialogtext.
>
> in linux i do for this way:
> pythonstringtext=qstringtext.text().toUtf8.data()
> and it return a python string correctly.


Hi Carlos,

This seems like a question that's very specific to Qt: you may want to
ask on a Qt-Python mailing list.  Tutor is intended for beginner
programmers, and the question you're asking seems a bit specialized
for the intended audience.


In absence of this information, I have to make a few guesses.  My best
guesses so far are that you're working with Qt, which provides its own
Unicode string class:

http://qt-project.org/doc/qt-4.8/qstring.html

Are you using PyQt 4 or PyQt 5, or something else entirely?  Are you
using Python 2 or Python 3?

According to the PyQt5 documentation, it automatically handles the
string conversion:


http://pyqt.sourceforge.net/Docs/PyQt5/gotchas.html#python-strings-qt-strings-and-unicode

and according to the PyQt 4 documentation, it also handles the
conversion automatically for you:

http://pyqt.sourceforge.net/Docs/PyQt4/python_v3.html#qstring

and because the mapping is done by the library, you should not have to
be doing anything on your own end to convert Qstrings to Python
strings.


Yeah, I am not sure what you are doing yet, because the documentation
says that it handles conversions for you.  The fact that you're doing
this manually suggests that you might be doing something unusual.  We
need more information.  But I think you may get better help on a
Qt-specific mailing list; I suspect very few of us here have Qt
experience.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Convert Qstring to string in windows

2014-10-16 Thread Albert-Jan Roskam

-
On Thu, Oct 16, 2014 10:59 PM CEST Alan Gauld wrote:

>On 16/10/14 19:14, Danny Yoo wrote:
>
>> need more information.  But I think you may get better help on a
>> Qt-specific mailing list; I suspect very few of us here have Qt
>> experience.
>
>There are at least 2 Python Qt mailing lists and also two for
>Side which is Nokia's public domain fork of Qt. That's probably
>worth a look too.
>
>Definitely in the minority interest camp on the tutor list.
>

I am not 100 % sure but I think you can use str() on a qstring. In other words, 
it has its own __str__ method.

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Registering callbacks and .DLL

2014-10-16 Thread Alan Gauld

On 17/10/14 00:35, Wilson, Pete wrote:

I’m having problems registering a call-back with a .DLL. Maybe someone
has some advice on registering call-backs from .dlls.

I’m using Windows 7 and Python 2.6 (32-bits). The .DLL was written in
C++ is working with C++ apps calling it.


OK As I understand it, You are trying to register a Python function
as a call back on a C++ function in a DLL is that correct?

Do you have any code? I don't see any attachment. Many lists/servers
strip out binary attachments as potential viruses so it may not have
made it through. Code is best included inline as text provided its not 
too long, or alternatively, in a pastebin.



I tried the methods in section 15.17.1.17 with the qsort() and
CFUNCTYPE, but it is not working.  My code and the .dll are attached.


Section 15.17.1.17 of what? Not the tutorial, not the library
reference and not the language reference. So what?

This question may be a tad too complex for the tutor list which
is targeted to those learning Python, you probably want the main
list for this. But you are going to have to provide some code
and a more detailed description of what you are trying to do.

--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.flickr.com/photos/alangauldphotos

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor