detect mouse pointer type
Hello, please how can I detect mouse pointer type? I would like to print every mouse pointer change (arrow, hand, ...) while moving my mouse over screen. How can I do this? (for now I need it for windows, but cross-platform solution is highly appreciated) Many thanks. -- https://mail.python.org/mailman/listinfo/python-list
PYQT4 referer in javascript still blank
Hello, I am trying to set referrer for my script this way in PYQT4: class NetworkManager(QNetworkAccessManager): def createRequest(self, op, req, outgoing_data): req.setRawHeader('Referer', 'http://www.my-university.com/') req.setRawHeader('Accept-Language', 'en') return super(NetworkManager, self).createRequest(op, req, outgoing_data) but when I use javascript document.write('js ref: ' + document.referrer +''); on my website it still returns empty line. When I use php $_SERVER["HTTP_REFERER"] it returns correct referer. How should I make it working for javascript as well? -- https://mail.python.org/mailman/listinfo/python-list
after application close MS Visual C++ runtime library error occurs
Hello, I am using psycopg2 in windows app, example: import psycopg2 import psycopg2.extras self.con = psycopg2.connect("dbname= host= user= password= port="); self.cur = self.con.cursor(cursor_factory=psycopg2.extras.DictCursor) SELECT = "select something" self.cur.execute(SELECT) for row in self.cur: ... self.cur.close() self.con.close() But when I click on exit button in application MS Visual C++ runtime library error occurs: This application has requested the runtime to terminate it in unusual way. What am I doing wrong? -- http://mail.python.org/mailman/listinfo/python-list
aboutdialog space between program name/version and logo
Hello, please how can i set space between program name/version and logo in this code? thanks about = gtk.AboutDialog() about.set_program_name("name") about.set_version("0.0.1") about.set_logo(gtk.gdk.pixbuf_new_from_file("file.png")) -- http://mail.python.org/mailman/listinfo/python-list
incorporate png/ico to exe and use it in application
hello, I am zsing py2exe to compile exe files. I would like to incorporate png and icon file into exe and then use it during program run (to show it in about dialog and system tray). How can I do it? For example now I use self.staticon.set_from_file(os.path.join(module_path(), "icon.ico")) but I would like to prevent user from changeing this icon. Thanks -- http://mail.python.org/mailman/listinfo/python-list
problem with GTK language
Hello, I have strange problem with gtk language in pygtk. When I run .py file it shows all gtk labels in my default windows language (slovak). But when I compile it with py2exe and run exe file all labels are in english. Why this happens? How can I define on program startup which language to use? I would like to choose between english and slovak. I tryed to set locals in my application but no luck. What am I doing wrong? thank you -- http://mail.python.org/mailman/listinfo/python-list
gtk STOCK_SAVE text in another language
hello, I have slovak win but I would like to have english captions on pygtk STOCK_SAVE buttons. How can I set this? thanks -- http://mail.python.org/mailman/listinfo/python-list
HSeparator() in gtk.layour
hello, how can I add hseparator to gtk.layout? I tried hseparator = gtk.HSeparator() self.layout.put(hseparator, 50,195) but it does not work :/ -- http://mail.python.org/mailman/listinfo/python-list
Re: change gtk STOCK_SAVE label text on the fly
> (Don't feel you need to answer this: Do you really think you need on-the-fly language switching? It's "cool", but how many users are going to want to use that?) yes, you're right. anyway it's cool feature and I hoped it's easy to do it in python / but it isn't... > Why do you want to change it? I assume it's being used in some dialog > class you're using; which one? Does it not allow you to set the button > text when you create it? I tried to do that in pygtk but no success. I thought this will be quick fix because my newbie knowledge does not allow me to set/change locale when app starts. Of course I would prefer another way of doing this but how can I tell to gtk which language use ? -- http://mail.python.org/mailman/listinfo/python-list
change gtk STOCK_SAVE label text on the fly
Hello, how could I change STOCK_SAVE label text? I would like to have "Save it!" instead of "Save" And other question related to this is how can I change translation of STOCK_SAVE on the fly? I think I need to set locale for pygtk...but don't know how -- http://mail.python.org/mailman/listinfo/python-list
Re: multilanguage application - step by step
> Well, it depends on how you're constructing your interface. If you're > creating all the widgets in Python code, you could move all your > foo.text = "Bar"; statements to one method that updates the text for all > widgets, and call that both from the constructor and from the > language-switching event handler. Thanks again. I am using pygtk so I should call function to change all text, labels, etc. (I thought there is simplier solution) But I don't know how to change texts on menu items. Usually I am using this code to build menus: Any advice how to refresh menus please? self.menu_items = ( ( "/_Languages", None,None, 0, "" ), ( "/Languages/_english", None,self.print_lang, 0, "" ), ( "/Languages/_german", None,self.print_lang, 0, "" ), ) self.vbox = gtk.VBox(False, 0) self.menubar = self.get_main_menu(self.okno) self.vbox.pack_start(self.menubar, False, True, 0) self.menubar.show() def get_main_menu(self, window): accel_group = gtk.AccelGroup() item_factory = gtk.ItemFactory(gtk.MenuBar, "", accel_group) item_factory.create_items(self.menu_items) window.add_accel_group(accel_group) self.item_factory = item_factory return item_factory.get_widget("") -- http://mail.python.org/mailman/listinfo/python-list
how to make checkitem menu and allow to be checked only one item?
Hello geeks, I have this code in my app: self.menu_items = ( ( "/_Languages", None,None, 0, "" ), ( "/Languages/_english", None,self.print_lang, 0, "" ), ( "/Languages/_german", None,self.print_lang, 0, "" ), ) self.vbox = gtk.VBox(False, 0) self.menubar = self.get_main_menu(self.okno) self.vbox.pack_start(self.menubar, False, True, 0) self.menubar.show() def get_main_menu(self, window): accel_group = gtk.AccelGroup() item_factory = gtk.ItemFactory(gtk.MenuBar, "", accel_group) # This method generates the menu items. Pass to the item factory # the list of menu items item_factory.create_items(self.menu_items) # Attach the new accelerator group to the window. window.add_accel_group(accel_group) # need to keep a reference to item_factory to prevent its destruction self.item_factory = item_factory # Finally, return the actual menu bar created by the item factory. return item_factory.get_widget("") how to make checkitem menu and allow to be checked only one item? I would like to have english checked but not german at the same time. And when I click on german it should uncheck english. How to make this? And other question: I am using self.print_lang function and I would like to have something like this ( "/Languages/_english", None,self.print_lang('en'), 0, "" ) but the problem is self.print_lang('en') with parameter 'en' is automatically executed after app run. I can use only self.print_lang without parameter or use callback integer (default-0, or other integers) - but this is not very comfortable. Any advice for this? many thanks in advance -- http://mail.python.org/mailman/listinfo/python-list
Re: multilanguage application - step by step
Hello Thomas, > The usual way of using gettext is to use the system locale to determine > the right language. Of course, you can have different translations and > install() them (I expect), but you'll have to re-load all the strings > displayed in your application when you switch language, which might be > tricky. thank you now it works and all my string are translated. But as you said switching languages is small problem now. I am using pygtk and I have no idea how to re-load all strings in my app when I click on button with another language. Any idea? > The usual way of using gettext is to use the system locale to determine Why is usually gettext use with system locale? I think the better way is to leave user to select his language (or switch to another). Should I use something else than gettext in this case? thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: gettext switch language on the fly
hello Chris, I am using pygtk. 2011/7/29 Chris Rebert > On Thu, Jul 28, 2011 at 6:20 PM, Peter Irbizon > wrote: > > hello, > > I am using gettext fo localization > > > Now I would like to switch all texts in my app when I click on item in > menu. > > Unfortunatelly this not switch texts immediately. How can I do this? > > Which GUI toolkit are you using? > > Cheers, > Chris > -- http://mail.python.org/mailman/listinfo/python-list
gettext switch language on the fly
hello, I am using gettext fo localization local_path=os.path.join(module_path(), lang_folder) gettext.bindtextdomain(lang_name, local_path) gettext.textdomain(lang_name) # Get the language to use lang = gettext.translation(lang_name, local_path, languages=['sk'], fallback = True) lang.install() Now I would like to switch all texts in my app when I click on item in menu. Unfortunatelly this not switch texts immediately. How can I do this? -- http://mail.python.org/mailman/listinfo/python-list
Re: multilanguage application - step by step
Hello, thank you for reply. I tried this: # -*- coding: utf-8 -*- import gettext gettext.bindtextdomain('multilanguage', 'E:\folder') gettext.textdomain('multilanguage') _ = gettext.gettext # ... lang1 = gettext.translation('multilanguage', languages=['sk']) lang1.install() print _('This is a translatable string.') but ErrNo 2 no translation file found for domain: 'multilanguage' I am doing something wrong way. I would like to switch languages in my program 'on the fly' without affecting windows. P.S. sorry for double posting but when I post my message on googlegroups I can't see it in googlegroups (don't know why) thanks 2011/7/28 Chris Rebert > On Thu, Jul 28, 2011 at 2:11 AM, Peter Irbizon > wrote: > > Hello guys, > > > > I would like to translate all strings in my application for several > > languages (eng, es, de, etc) and user should be able to switch app > > from one language to another. I am still newbie with python so is > > there any "step-by-step" tutorial how to to this? thanks for help > > Please refrain from double-posting in the future. > > The `gettext` module's docs look fairly straightforward: > > http://docs.python.org/library/gettext.html#internationalizing-your-programs-and-modules > See also the "Here’s an example of typical usage for this API:" code > snippet. > > For the translation file workflow, the Wikipedia article seems > enlightening: > http://en.wikipedia.org/wiki/GNU_gettext > > Cheers, > Chris > -- > http://rebertia.com > -- http://mail.python.org/mailman/listinfo/python-list
multilanguage application - step by step
Hello guys, I would like to translate all strings in my application for several languages (eng, es, de, etc) and user should be able to switch app from one language to another. I am still newbie with python so is there any "step-by-step" tutorial how to to this? thanks for help -- http://mail.python.org/mailman/listinfo/python-list
The following modules appear to be missing - py2exe
Hello, please I have problem with "The following modules appear to be missing" message during compiling my app exe file with py2exe. What should I do with this? Many thanks in advance. The following modules appear to be missing ['Carbon', 'Carbon.Files', '_scproxy', 'fixedpoint', 'gdk', 'mx', 'unix', 'glib. GError', 'glib.IOChannel', 'glib.IO_ERR', 'glib.IO_FLAG_APPEND', 'glib.IO_FLAG_G ET_MASK', 'glib.IO_FLAG_IS_READABLE', 'glib.IO_FLAG_IS_SEEKABLE', 'glib.IO_FLAG_ IS_WRITEABLE', 'glib.IO_FLAG_MASK', 'glib.IO_FLAG_NONBLOCK', 'glib.IO_FLAG_SET_M ASK', 'glib.IO_HUP', 'glib.IO_IN', 'glib.IO_NVAL', 'glib.IO_OUT', 'glib.IO_PRI', 'glib.IO_STATUS_AGAIN', 'glib.IO_STATUS_EOF', 'glib.IO_STATUS_ERROR', 'glib.IO_ STATUS_NORMAL', 'glib.Idle', 'glib.MainContext', 'glib.MainLoop', 'glib.OPTION_E RROR', 'glib.OPTION_ERROR_BAD_VALUE', 'glib.OPTION_ERROR_FAILED', 'glib.OPTION_E RROR_UNKNOWN_OPTION', 'glib.OPTION_FLAG_FILENAME', 'glib.OPTION_FLAG_HIDDEN', 'g lib.OPTION_FLAG_IN_MAIN', 'glib.OPTION_FLAG_NOALIAS', 'glib.OPTION_FLAG_NO_ARG', 'glib.OPTION_FLAG_OPTIONAL_ARG', 'glib.OPTION_FLAG_REVERSE', 'glib.OPTION_REMAI NING', 'glib.OptionContext', 'glib.OptionGroup', 'glib.PRIORITY_DEFAULT', 'glib. PRIORITY_DEFAULT_IDLE', 'glib.PRIORITY_HIGH', 'glib.PRIORITY_HIGH_IDLE', 'glib.P RIORITY_LOW', 'glib.Pid', 'glib.PollFD', 'glib.SPAWN_CHILD_INHERITS_STDIN', 'gli b.SPAWN_DO_NOT_REAP_CHILD', 'glib.SPAWN_FILE_AND_ARGV_ZERO', 'glib.SPAWN_LEAVE_D ESCRIPTORS_OPEN', 'glib.SPAWN_SEARCH_PATH', 'glib.SPAWN_STDERR_TO_DEV_NULL', 'gl ib.SPAWN_STDOUT_TO_DEV_NULL', 'glib.Source', 'glib.Timeout', 'glib.child_watch_a dd', 'glib.filename_display_basename', 'glib.filename_display_name', 'glib.filen ame_from_utf8', 'glib.get_application_name', 'glib.get_current_time', 'glib.get_ prgname', 'glib.glib_version', 'glib.idle_add', 'glib.io_add_watch', 'glib.main_ context_default', 'glib.main_depth', 'glib.markup_escape_text', 'glib.set_applic ation_name', 'glib.set_prgname', 'glib.source_remove', 'glib.spawn_async', 'glib .timeout_add', 'glib.timeout_add_seconds', 'glib.uri_list_extract_uris'] *** binary dependencies *** Your executable(s) also depend on these dlls which are not included, you may or may not need to distribute them. Make sure you have the license if you distribute any of them, and make sure you don't distribute files belonging to the operating system. USP10.DLL - C:\WINDOWS\system32\USP10.DLL OLEAUT32.dll - C:\WINDOWS\system32\OLEAUT32.dll USER32.dll - C:\WINDOWS\system32\USER32.dll POWRPROF.dll - C:\WINDOWS\system32\POWRPROF.dll SHELL32.dll - C:\WINDOWS\system32\SHELL32.dll ole32.dll - C:\WINDOWS\system32\ole32.dll SHLWAPI.DLL - C:\WINDOWS\system32\SHLWAPI.DLL COMDLG32.DLL - C:\WINDOWS\system32\COMDLG32.DLL ADVAPI32.DLL - C:\WINDOWS\system32\ADVAPI32.DLL msvcrt.dll - C:\WINDOWS\system32\msvcrt.dll WS2_32.dll - C:\WINDOWS\system32\WS2_32.dll WINSPOOL.DRV - C:\WINDOWS\system32\WINSPOOL.DRV GDI32.dll - C:\WINDOWS\system32\GDI32.dll DNSAPI.DLL - C:\WINDOWS\system32\DNSAPI.DLL VERSION.dll - C:\WINDOWS\system32\VERSION.dll KERNEL32.dll - C:\WINDOWS\system32\KERNEL32.dll IMM32.DLL - C:\WINDOWS\system32\IMM32.DLL COMCTL32.DLL - C:\WINDOWS\system32\COMCTL32.DLL MSIMG32.DLL - C:\WINDOWS\system32\MSIMG32.DLL MPR.dll - C:\WINDOWS\system32\MPR.dll gdiplus.dll - C:\WINDOWS\system32\gdiplus.dll -- http://mail.python.org/mailman/listinfo/python-list
Re: module problem on windows 64bit
> kinterbasdb's extension module _kinterbasdb.pyd depends on the shared > library fbclient.dll. The Firebird client library is of the Firebird SQL > server. As I already explained you have to install the 32bit (!) version > of Firebird and enable the "copy client dll to system32" option during > the installation. yes, that's right. but I am using embedable version of fbclient.dll so I don't need to install Firebird Sql Server package. all dlls are in my program folder even so it does not work. -- http://mail.python.org/mailman/listinfo/python-list
Re: can I distribute Microsoft.VC90.CRT files?
> Read the EULA that comes with Microsoft Visual C++ Redistributable Package. thanks. hm, but it looks like every user should download redistributable package and then istall it, right? I would like to prevent this because every action which requires user's interaction is not good (high chance he will mess something) :) is there any elegant work around for this? it looks like only 64 bit systems need these dlls. -- http://mail.python.org/mailman/listinfo/python-list
Re: module problem on windows 64bit
>> Are you running 32bit or 64bit Python on your 64bit Windows box? You >> have to install the same flavour of Python, kinterbasdb and Firebird SQL >> (all 32bit or all 64bit). You also have to check the "copy client dlls >> to system directory" check box during the installation of Firebird SQL. >> >> I guess that you have a 32bit installation of Python but a 64bit >> installation of Firebird SQL. >> Christian well, my program exe generated from py2exe. I am running Python 2.7 on my win xp 32bit box then I compile my application with py2exe. After that I can use it on other computers (on 32bit everything works perfect) but on 64 bit windows I am getting this error. :( -- http://mail.python.org/mailman/listinfo/python-list
can I distribute Microsoft.VC90.CRT files?
hello, I find out that my program needs Microsoft.VC90.CRT.manifest,msvcm90.dll,msvcp90.dll,msvcr90.dll files when I want to run it on win 64bit systems. I find these files in some other software. Can I simply take it from another software then include it to my program folder and distribute it this way? Is it violation or not? -- http://mail.python.org/mailman/listinfo/python-list
module problem on windows 64bit
Hello, on 32-bit windows everything works ok but on 64-bit win I am getting this error: Traceback (most recent call last): File "app.py", line 1040, in do_this_now File "kinterbasdb\__init__.pyc", line 119, in File "kinterbasdb\_kinterbasdb.pyc", line 12, in File "kinterbasdb\_kinterbasdb.pyc", line 10, in __load ImportError: DLL load failed: This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem. How to get it work on 64bit windows as well? many thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: python + php encrypt/decrypt
Hello Ian, thanks, I found another php script but it is not working as well :/ What am I doing wrong? And I have another question too: when I use text for encoding "Text for 1" and "Text for 11" the first letters of encoded strings are the same in both strings? here is my py: # -*- coding: utf-8 -*- from Crypto.Cipher import AES import base64 import os # the block size for the cipher object; must be 16, 24, or 32 for AES BLOCK_SIZE = 16 # the character used for padding--with a block cipher such as AES, the value # you encrypt must be a multiple of BLOCK_SIZE in length. This character is # used to ensure that your value is always a multiple of BLOCK_SIZE PADDING = '{' # one-liner to sufficiently pad the text to be encrypted pad = lambda s: s + (BLOCK_SIZE - len(s) % BLOCK_SIZE) * PADDING # one-liners to encrypt/encode and decrypt/decode a string # encrypt with AES, encode with base64 EncodeAES = lambda c, s: base64.b64encode(c.encrypt(pad(s))) DecodeAES = lambda c, e: c.decrypt(base64.b64decode(e)).rstrip(PADDING) # generate a random secret key secret = "passkeypasskeyaa" #os.urandom(BLOCK_SIZE) iv='1234567890123456' # create a cipher object using the random secret #cipher = AES.new(secret) cipher = AES.new(secret, AES.MODE_CBC, iv) # encode a string tajnytext ='Alice has a cat' #tajnytext=tajnytext.encode('hex') encoded = EncodeAES(cipher, tajnytext) #encoded = EncodeAES(cipher, 'password') print encoded print encoded.encode('hex') #print 'Encrypted string:', encoded # decode the encoded string decoded = DecodeAES(cipher, encoded) print 'Decrypted string:', decoded and my php: http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation // CBC mode requires an initialization vector. The size of the IV (initialization // vector) is always equal to the block-size. (It is NOT equal to the key size.) // Given that our block size is 128-bits, the IV is also 128-bits (i.e. 16 bytes). // Thus, for AES encryption, the IV is always 16 bytes regardless of the // strength of encryption. // // Here's some PHP code to verify our IV size: //$iv_size = mcrypt_enc_get_iv_size($cipher); //printf("iv_size = %d\n",$iv_size); // How do you do 256-bit AES encryption in PHP vs. 128-bit AES encryption??? // The answer is: Give it a key that's 32 bytes long as opposed to 16 bytes long. // For example: $key256 = 'passkeypasskeyaa'; //$key128 = '1234567890123456'; // Here's our 128-bit IV which is used for both 256-bit and 128-bit keys. $iv = '1234567890123456'; //printf("iv: %s\n",bin2hex($iv)); //printf("key256: %s\n",bin2hex($key256)); //printf("key128: %s\n",bin2hex($key128)); // This is the plain-text to be encrypted: $cleartext = 'Alice has a cat'; //printf("plainText: %s\n\n",$cleartext); // The mcrypt_generic_init function initializes the cipher by specifying both // the key and the IV. The length of the key determines whether we're doing // 128-bit, 192-bit, or 256-bit encryption. // Let's do 256-bit encryption here: if (mcrypt_generic_init($cipher, $key256, $iv) != -1) { // PHP pads with NULL bytes if $cleartext is not a multiple of the block size.. $cipherText = mcrypt_generic($cipher,$cleartext ); mcrypt_generic_deinit($cipher); // Display the result in hex. printf("256-bit encrypted result:\n%s\n\n",bin2hex($cipherText)); } // Now let's do 128-bit encryption: //if (mcrypt_generic_init($cipher, $key128, $iv) != -1) //{ // PHP pads with NULL bytes if $cleartext is not a multiple of the block size.. // $cipherText = mcrypt_generic($cipher,$cleartext ); // mcrypt_generic_deinit($cipher); // Display the result in hex. // printf("128-bit encrypted result:\n%s\n\n",bin2hex($cipherText)); // } // --- // Results // --- // You may use these as test vectors for testing your AES implementations... // // // 256-bit key, CBC mode // // IV = '1234567890123456' // (hex: 31323334353637383930313233343536) // Key = '12345678901234561234567890123456' // (hex: 3132333435363738393031323334353631323334353637383930313233343536) // PlainText: // 'The quick brown fox jumped over the lazy dog' // CipherText(hex): // 2fddc3abec692e1572d9b7d629172a05caf230bc7c8fd2d26ccfd65f9c54526984f7cb1c4326ef058cd7bee3967299e3 // // // 128-bit key, CBC mode // // IV = '1234567890123456' // (hex: 31323334353637383930313233343536) // Key = '1234567890123456' // (hex: 31323334353637383930313233343536) // PlainText: // 'The quick brown fox jumped over the lazy dog' // CipherText(hex): // f78176ae8dfe84578529208d30f446bbb29a64dc388b5c0b63140a4f316b3f341fe7d3b1a3cc5113c81ef8dd714a1c99 ?> 2011/6/7 Ian Kelly > On Mon, Jun 6, 2011 at 4:19 PM, miamia wrote: > > php I am trying to use is here: > > > http://code.google.com/p/antares4pymes/source/browse/trunk/library/System/Crypt/AES.php?r=20 > > That library does not appear to be doing CBC as far a
ugly exe icon in win7/vista
Hello, I am trying to make nice icons for my program. I compiled it with py2exe but problem is that exe icon in Win 7/vista is not very nice (it looks like win7 takes 32x32 instead of 248x248icon) I used png2ico to pack icon file: png2ico icon.ico png248x248.png png32x32.png png16x16.png Any idea why win7 is showing 16x16(or 32x32) as exe icon? -- http://mail.python.org/mailman/listinfo/python-list
Re: python + php encrypt/decrypt
Hello, thanks, Unfortunatelly I don't understand how xml should resolve my issue. My problem is: I am trying to use aes256 cbc on python and php to decrypt "textstring". But results are not the same in php and python. Any idea why? password and iv is the same so I don't know where is the problem. I am trying do decrypt data in python then store it as base64 and read and decrypt it in php. 2011/6/4 > Use xml to pass the encrypt text. > > > On , Peter Irbizon wrote: > > > > Hello, > > > > I would like to encrypt text in python and decrypt it in my PHP script. I > tried to use pycrypto and some aes php scripts but the results are not the > same. Please, is there any example (the best way source codes) how to do > this in python and PHP? > > > -- http://mail.python.org/mailman/listinfo/python-list
python + php encrypt/decrypt
Hello, I would like to encrypt text in python and decrypt it in my PHP script. I tried to use pycrypto and some aes php scripts but the results are not the same. Please, is there any example (the best way source codes) how to do this in python and PHP? -- http://mail.python.org/mailman/listinfo/python-list