[Tutor] Howto handle pictures with pyqt
Hello, for my first python program I try to build a user interface for a litle address database. Therefor I use pyqt to build the formular, and later I will connect it to an existing SQLite DB, using APSW. Besides the "normal" things as name, address, email and others I want to store an image. Normaly that will be given as a file (.jpg, .png, or other type). I would let the user find the picture with a QFileDialog.getOpenFileName() dialog. But what to do after that? Here are my questions: Which widget is able to show the picture? How to show the picture? That means: howto put the picture from the file into the widget? How to put the picture data into an blob(?) column in the database? How to get the data back from there and bring it in the widget? May be there is a tutorial which I didn't find yet? Thank's a lot for any help! Greetings Ulrich -- Ulrich Goebel Paracelsusstr. 120, 53177 Bonn ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
[Tutor] String representation of NULL (non type) values
Hallo, from a SQLite database I get a value by SELECT s from... which normaly is a string, but can be the NULL value, wich means it is not defined. To put the value into a form (made by QT) I need a string representation. str(s) gives either the string itself (which is good) or "None" (which is not so good) in the case of NULL. Instead of "None" I would prefer an empty string "". How to get that? Possibly there is a build in function smart(s1, s2, s3,...) which returns the first s which is a useable string, or even "" if there isn't any string in the arguments? Thanks for help Ulrich -- Ulrich Goebel Paracelsusstr. 120, 53177 Bonn ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
[Tutor] unicode: alpha, whitespaces and digits
Hallo, I have a unicode string s, for example u"abc", u"äöü", u"123" or something else, and I have to find out wether 1. s is not empty and contains only digits (as in u"123", but not in u"3.1415") or 2. s is empty or contains only whitespaces For all other cases I would assume a "normal" unicode string in s, whatever that may be. For the first case it could be s.isdigit(), s.isnumeric() or s.isdecimal() - but which one is the best? For the second case it should be s.isspace(), but it works only on strings, not on unicode strings? Many thanks for any help! Ulrich -- Ulrich Goebel Paracelsusstr. 120, 53177 Bonn ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
[Tutor] Printing from python
Hallo, is there another way to pritt a PDF form python? My problem is a PDF which is printed well by evince, but not with lp, even not out of python using os.system("lp some_options file.pdf") Later on I have to build the PDF in a python program (using reportlab) and then print it, even from the python program. So I look for a (nice documented) library which give access to the CUPS API or something else to print the PDF from python. Any help is welcome! Ulrich -- Ulrich Goebel Paracelsusstr. 120, 53177 Bonn ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Printing from python
I just found a hint, the Qt QPrinter Class. I use Qt, so that could be a solution? Am 14.03.2014 11:40, schrieb Ulrich Goebel: Hallo, is there another way to pritt a PDF form python? My problem is a PDF which is printed well by evince, but not with lp, even not out of python using os.system("lp some_options file.pdf") Later on I have to build the PDF in a python program (using reportlab) and then print it, even from the python program. So I look for a (nice documented) library which give access to the CUPS API or something else to print the PDF from python. Any help is welcome! Ulrich -- Ulrich Goebel Paracelsusstr. 120, 53177 Bonn ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Printing from python
Am 14.03.2014 11:40, schrieb Ulrich Goebel: is there another way to pritt a PDF form python? sorry, that doesn't make sense. I should say: is there another way ... besides os.system()? -- Ulrich Goebel Paracelsusstr. 120, 53177 Bonn ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor