Re: python gui using boa
Thanks Steve, i found out the solution to the problem. but a good tutorial on sizers is still missing. -- http://mail.python.org/mailman/listinfo/python-list
Re: python gui using boa
Thanks Brian, that was a good introduction. I have another query for you - how can i make a captionless frame draggable in wxWindows? -- http://mail.python.org/mailman/listinfo/python-list
Re: python gui using boa
Thanks Brian, I could do it. actually it needs all the three mouse events - LeftDown, LeftUp and MouseMove. with regards, Ashoka -- http://mail.python.org/mailman/listinfo/python-list
UnicodeDecodeError
hi, one of the modules in my programs stopped wroking after i upgraded from python 2.3 to 2.4. I also changed my wxPython to unicode supported one during the process. what the module essentially does is search for a stirng pattern form a list of strings. this is the function: def srchqu(self): for i in range(1,len(qu)):#qu is the list of strings if qu[i][0].lower().find(self.query)==-1: pass else: #do some stuff here I get this error message on calling the function: Traceback (most recent call last): File "E:\mdi\search.py", line 86, in OnSrchButton self.srchqu() File "E:\mdi\search.py", line 97, in srchqu if qu[i][0].lower().find(self.query)==-1: UnicodeDecodeError: 'ascii' codec can't decode byte 0x92 in position 66: ordinal not in range(128) what is the problem and the solution? thanks in advance for any help. Ashoka -- http://mail.python.org/mailman/listinfo/python-list
Re: UnicodeDecodeError
Thanks Fredrik, i decoded both qu[i][0] and self.query to latin_1 (self.query.decode("latin_1")) and i am not getting the error now. If you dont mind, I have another question for you. I use wxPython for GUI development. When i use a string containing "&" character as a label for statictext, the "&" does'nt appear.It is replaced by a short _. I have tried different encodings but have no success. what should i do so that "&" appears on screen? thanks once againg for your help. regards, Ashoka -- http://mail.python.org/mailman/listinfo/python-list
how to run an external program...
hi, i want to know is there a way to run/control an external program form within a python program? thanks in advance for any support. -- http://mail.python.org/mailman/listinfo/python-list
Re: how to run an external program...
Thanks for Philippe, Larry and Fredrik for the help. the subprocess module did the trick. -- http://mail.python.org/mailman/listinfo/python-list
Re: UnicodeDecodeError
Thanks Jarek, doubling worked. I thought it was a problem with encoding but didnt think of escaping it. thanks a lot. Thanks for Fredrik too for taking the trouble. Regards, Ashoka -- http://mail.python.org/mailman/listinfo/python-list
EOF error
hi, when i try to unpickle a pickled file in binary format, i get this error: E:\mdi>test.py Traceback (most recent call last): File "E:\mdi\qp.py", line 458, in OnReadButton data=p.load(file("ques.dat","r")) EOFError what is the reason? how do i overcome this? Thanks in advance for you valuable time -- http://mail.python.org/mailman/listinfo/python-list
register keyevent in wxpython
hi, is there a way to register application wide hotkey in wxpython? i tried wxWindow::RegisterHotKey(). but the problem is it registers the hotkey as a system wide hotkey. this causes problems in other applications running concurrently which use the same hotkey. i want to do this because i want my app frame (a mdi frame) to accept the key event and wx.frame accepts only wx.eventCharHook() which raises no keyevent for normal alphanumeric keys. any ideas?? thanks in advance for any help. -- http://mail.python.org/mailman/listinfo/python-list
Enthought python - Traits
Hello everyone ! I am trying to find some sort of a cookbook or more examples for using Enthought Traits to build GUI's. I tried to follow the documentations present at the enthought site, but couldnt get too far - especially on how to handle a control event ? Also while i am on the topic: say i have a list "control" that create using the following two lines: class Project(HasTraits): coordinate_system=Enum('Cartesian','Cylindrical') I added the following line to get the option selected by the user: def _coordinate_system_changed(self,old,new): print 'System changed from %s to %s ' %(old,new) but it does not return what the user select. It should return either 0 or 1 based on the two choices, but i can't seem to find a way to trap that. I am relatively new to this GUI programming in Python and really could use some tips/hints. Thanks, -Ash -- http://mail.python.org/mailman/listinfo/python-list
Re: Enthought python - Traits
Thanks Peter .. I will check out the mailing list. In the meanwhile - i have made some progress. Now working out - how to get a button_fired event to actually return the values .. It's a process (as always..) Cheers, -A Peter Wang wrote: > Ash wrote: > > Hello everyone ! > > > > I am trying to find some sort of a cookbook or more examples for using > > Enthought Traits to build GUI's. I tried to follow the documentations > > present at the enthought site, but couldnt get too far - especially on > > how to handle a control event ? > > The traits manual is in the lib/site-packages/enthought/traits/doc > directory, named Traits2_UM.doc/.pdf. The traits UI manual/user guide > is also in there. However, what is not so obvious is that there is > also an excellent, massive set of powerpoint slides (121 pages) that > Dave Morrill put together that talks about the architecture of Traits > UI, and how to build GUIs using it. (Er, how to build them *well*, > i.e. adhering to the M-V-C pattern and maximizing code reuse.) Those > slides are in traits_ui.ppt. > > > say i have a list "control" that create using the following two lines: > > > > class Project(HasTraits): > > coordinate_system=Enum('Cartesian','Cylindrical') > > > > I added the following line to get the option selected by the user: > > > > def _coordinate_system_changed(self,old,new): > > print 'System changed from %s to %s ' %(old,new) > > > > but it does not return what the user select. It should return either 0 > > or 1 based on the two choices, but i can't seem to find a way to trap > > that. > > The way that this works is that _coordinate_system_changed() gets > called with the old value and the new value of self.coordinate_system. > Thus, it doesn't "return" anything; your method is a "handler" method > that gets called when the value of a particular trait gets changed. > > Why do you say it should return 0 or 1? Do you mean that you want to > get the index into the list of enumeration choices? The Enum trait > type is not quite like C in this regard. In C/C++, enums are really > ints; in traits, enums are lists of values of possibly mixed type. > > > I am relatively new to this GUI programming in Python and really could > > use some tips/hints. > > No problem, hope the above helped. You might want to email your > questions to [EMAIL PROTECTED] (and subscribe to it!). That > is the primary mailing list for several enthought libraries (including > traits) and you'll get very speedy, in-depth answers to your questions > there. > > > -Peter -- http://mail.python.org/mailman/listinfo/python-list
Logger / I get all messages 2 times
Hi, I have this source: import logging import logging.config logging.config.fileConfig("logging.properties") log = logging.getLogger("qname") log.debug("message") --- OUTPUT DEBUG logger_test:8: message DEBUG logger_test:8: message --- FILE CONFIG [formatters] keys: detailed [handlers] keys: console [loggers] keys: root, engine [formatter_detailed] format: %(levelname)s %(module)s:%(lineno)d: %(message)s [handler_console] class: StreamHandler args: [] formatter: detailed [logger_root] level: ERROR handlers: console [logger_engine] level: DEBUG qualname: qname handlers: console --- Why do I get the log 2 times? -- http://mail.python.org/mailman/listinfo/python-list
Re: Logger / I get all messages 2 times
On Oct 23, 5:10 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > ASh wrote: > > Hi, > > > I have this source: > > > import logging > > import logging.config > > > logging.config.fileConfig("logging.properties") > > log = logging.getLogger("qname") > > log.debug("message") > > > --- OUTPUT > > DEBUG logger_test:8: message > > DEBUG logger_test:8: message > > > --- FILE CONFIG > > [formatters] > > keys: detailed > > > [handlers] > > keys: console > > > [loggers] > > keys: root, engine > > > [formatter_detailed] > > format: %(levelname)s %(module)s:%(lineno)d: %(message)s > > > [handler_console] > > class: StreamHandler > > args: [] > > formatter: detailed > > > [logger_root] > > level: ERROR > > handlers: console > > > [logger_engine] > > level: DEBUG > > qualname: qname > > handlers: console > > > --- > > > Why do I get the log 2 times? > > Because you add the handler "console" two times, to logger_engine and > logger_root. You should only add it to root, or set propagate to false. > > Diez What if I want to output only the specific logger to console and ignore every other? -- http://mail.python.org/mailman/listinfo/python-list
psycopg2 / psycopg2.DataError: invalid input syntax for type timestamp with time zone:
Hi, please help me understand why am I getting error with this query new_start_date = "NOW() - '29 days'::INTERVAL" self.dyndb.orderdb.query('''update set creation_date = %s where id_order = %s''', (new_start_date, "123")) ... psycopg2.DataError: invalid input syntax for type timestamp with time zone: "NOW() - '29 days'::INTERVAL" -- http://mail.python.org/mailman/listinfo/python-list
Re: psycopg2 / psycopg2.DataError: invalid input syntax for type timestamp with time zone:
On Mar 31, 12:26 am, Philip Semanchuk wrote: > On Mar 30, 2010, at 4:47 PM, ASh wrote: > > > Hi, please help me understand why am I getting error with this query > > > new_start_date = "NOW() - '29 days'::INTERVAL" > > self.dyndb.orderdb.query('''update set creation_date > > = %s > > where id_order = %s''', (new_start_date, "123")) > > > ... > > psycopg2.DataError: invalid input syntax for type timestamp with time > > zone: "NOW() - '29 days'::INTERVAL" > > Hi Anton, > It sounds to me like the problem is with your SQL rather than with > psycopg2 or Python. Try the query directly in Postgres -- does it work > there? If so, then your next step should be to ask on the psycopg2 > mailing list that Google can find for you. > > Good luck > Philip sql itself is correct -- http://mail.python.org/mailman/listinfo/python-list
Re: psycopg2 / psycopg2.DataError: invalid input syntax for type timestamp with time zone:
On Mar 31, 12:50 am, "D'Arcy J.M. Cain" wrote: > On Tue, 30 Mar 2010 13:47:42 -0700 (PDT) > > ASh wrote: > > Hi, please help me understand why am I getting error with this query > > > new_start_date = "NOW() - '29 days'::INTERVAL" > > self.dyndb.orderdb.query('''update set creation_date > > = %s > > where id_order = %s''', (new_start_date, "123")) > > Put single quotes around the first %s in the query. > > -- > D'Arcy J.M. Cain | Democracy is three > wolveshttp://www.druid.net/darcy/ | and a sheep voting on > +1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner. Tried like you said, got this error: psycopg2.ProgrammingError: syntax error at or near "NOW" LINE 1: update orderdb.orders set creation_date = 'E'NOW() - ''29 da... ^ -- http://mail.python.org/mailman/listinfo/python-list
How to print html in python the normal way
Hi, I wrote a simple filter as: @register.filter() def html(value): return 'Check' when I use this filter in my template, it displays html as: Check I want to display as: Check am I missing something. - Thanks for your help Ashish -- http://mail.python.org/mailman/listinfo/python-list
Re: How to print html in python the normal way
Hi, Thanks for the reply. Apologies for my question not clear. Yes I am using django framework for it. - Regards Ashish -- http://mail.python.org/mailman/listinfo/python-list
Tkinter, IDLE keeps crashing
Hey, So I've actually had this problem for awhile, and I cant seem to get anything to work. I've followed all the steps & procedures that my google searches have provide me, but I can't seem to get the Tkinter module or the Python IDLE IDE to work. For instance, if I click IDLE on my mac, it'll open up for a quick sec & produce an error. Or if I go into the Python interpreter, I import Tkinter, call Tk() Then it says: CGColor 1 components Abort Trap: 6, then get an error. I'll post this crash report below. My system is a Mac OS X 10.7 Lion. I'm running 2.7.3 Python I've installed the recommended version of ActiveState TCL/TK I still have problems. Does anyone have this problem, or know how to fix it? Process: Python [32420] Path: /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python Identifier: org.python.python Version: 2.7.3 (2.7.3) Code Type: X86-64 (Native) Parent Process: bash [32392] Date/Time: 2013-02-17 16:37:48.197 -0500 OS Version: Mac OS X 10.7.5 (11G63) Report Version: 9 Interval Since Last Report: 259971 sec Crashes Since Last Report: 14 Per-App Interval Since Last Report: 3 sec Per-App Crashes Since Last Report: 12 Anonymous UUID: 7007EE86-A10A-47A6-9F6D-76D091A76136 Crashed Thread: 0 Dispatch queue: com.apple.main-thread Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x, 0x Application Specific Information: abort() called objc[32420]: garbage collection is OFF Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 libsystem_kernel.dylib 0x7fff8aea2ce2 __pthread_kill + 10 1 libsystem_c.dylib 0x7fff8af097d2 pthread_kill + 95 2 libsystem_c.dylib 0x7fff8aefaa7a abort + 143 3 Tcl 0x000100623de7 Tcl_PanicVA + 449 4 Tcl 0x000100623e89 Tcl_Panic + 162 5 Tk 0x0001010acd8d TkpGetColor + 383 6 Tk 0x0001010bab1f TkpMenuInit + 156 7 Tk 0x00010103c764 TkMenuInit + 88 8 Tk 0x0001010bd803 -[TKApplication(TKMenus) _setupMenus] + 53 9 Tk 0x0001010b75da -[TKApplication(TKInit) _setup:] + 56 10 Tk 0x0001010b7b13 TkpInit + 545 11 Tk 0x00010102de42 Initialize + 1678 12 _tkinter.so 0x0001005a0d2b Tcl_AppInit + 75 13 _tkinter.so 0x00010059e1b4 Tkinter_Create + 916 14 org.python.python 0x0001000c1e7d PyEval_EvalFrameEx + 25213 15 org.python.python 0x0001000c4149 PyEval_EvalCodeEx + 2137 16 org.python.python 0x00010003d910 function_call + 176 17 org.python.python 0x0001c362 PyObject_Call + 98 18 org.python.python 0x00010001e97b instancemethod_call + 363 19 org.python.python 0x0001c362 PyObject_Call + 98 20 org.python.python 0x0001000ba947 PyEval_CallObjectWithKeywords + 87 21 org.python.python 0x000100021c0e PyInstance_New + 126 22 org.python.python 0x0001c362 PyObject_Call + 98 23 org.python.python 0x0001000bf2c8 PyEval_EvalFrameEx + 14024 24 org.python.python 0x0001000c286d PyEval_EvalFrameEx + 27757 25 org.python.python 0x0001000c4149 PyEval_EvalCodeEx + 2137 26 org.python.python 0x0001000c4266 PyEval_EvalCode + 54 27 org.python.python 0x0001000e8a0c PyRun_InteractiveOneFlags + 380 28 org.python.python 0x0001000e8c6e PyRun_InteractiveLoopFlags + 78 29 org.python.python 0x0001000e9451 PyRun_AnyFileExFlags + 161 30 org.python.python 0x00010010006d Py_Main + 3085 31 org.python.python 0x00010f14 0x1 + 3860 Thread 1:: Dispatch queue: com.apple.libdispatch-manager 0 libsystem_kernel.dylib 0x7fff8aea37e6 kevent + 10 1 libdispatch.dylib 0x7fff885e9786 _dispatch_mgr_invoke + 923 2 libdispatch.dylib 0x7fff885e8316 _dispatch_mgr_thread + 54 Thread 2: 0 libsystem_kernel.dylib 0x7fff8aea3192 __workq_kernreturn + 10 1 libsystem_c.dylib 0x7fff8af09594 _pthread_wqthread + 758 2 libsystem_c.dylib 0x7fff8af0ab85 start_wqthread + 13 Thread 3: 0 libsystem_kernel.dylib 0x7fff8aea3192 __workq_kernreturn + 10 1 libsystem_c.dylib 0x7fff8af09594 _pthread_wqthrea
Re: Tkinter, IDLE keeps crashing
I believe I have a MacBook Pro.2.4 GHz Intel Core i5. I dont think I have any weird color settings or 3rd party extensions... How can I tell exactly?? -- http://mail.python.org/mailman/listinfo/python-list
Re: Using Python from Cocoa App via PyObjc - numbers dont match...
In comp.lang.objective-c sapsi <[EMAIL PROTECTED]> wrote: > The first output in the console is 40.4 and the second > -40.4152587891. > > If i change the NSLog(s) to "%f",[n floatValue] (and the second > likewise) the first is 40.42 and the second is -40.42. I assume you are complaining about the fact that it's not printing exactly 40.4, and wondering where the error is coming from. (It helps if you actually state this yourself, so we don't have to assume it, rather than just laying out the circumstances.) The answer is that floating point numbers are inherently imprecise. Read through this essential resource: http://docs.sun.com/source/806-3568/ncg_goldberg.html -- Michael Ash Rogue Amoeba Software -- http://mail.python.org/mailman/listinfo/python-list