if-else statement
other languages like PHP or javascript as this if-else operator like this myVar = checking == 1? 'string': 'other string' is this stuff exist in python? thanks! -- http://mail.python.org/mailman/listinfo/python-list
python interpreter black window
I use WX gui so the user doesn't actually need it, Is their any way to hide it? thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: python interpreter black window
On Dec 26, 2:52 am, Scott David Daniels wrote: > Chris Rebert wrote: > > On Thu, Dec 25, 2008 at 3:32 PM, Gandalf wrote: > >> I use WX gui so the user doesn't actually need it, Is their any way to > >> hide it? > > > Make sure your Python program is run by pythonw.exe as opposed to python.exe > > pythonw.exe exists specifically for the purpose of suppressing the DOS > > Box on Windows. > > Absolutely right. Vy the way, naming your "main" program file > something.pyw, rather than something.py is one of the ways ro do this. > > --Scott David Daniels > scott.dani...@acm.org thanks! -- http://mail.python.org/mailman/listinfo/python-list
win32gui
Hi, I'm trying to capture the text word under the user cursor, so I was searching the win32 lib for functions I can use. i used this to fined the controller under the cursor win32gui.WindowFromPoint(win32gui.GetCursorPos()) to get the controller, but then when I try to read the text with this GetWindowText function it most of the time doesn't work, all the "getline" methon like the following didn't worked in most of the time too win32gui.SendMessage(hwnd, win32con.EM_GETLINE, line, linetext) I found this GetCharFromPosition in a VB forum which sound promising but unfortunately it's not part of the win32gui for python so now i'm looking for a reliable way to rich text from a controller or position if you know a function who may do it or a better way please tell me/ thank you and have a nice day -- http://mail.python.org/mailman/listinfo/python-list
win32gui
I'm searching the win32gui hooks for a function to get the windowClass position any idea? thanks! -- http://mail.python.org/mailman/listinfo/python-list
win32gui
Hi, everyone I'm searching the win32gui lib to find a way to get the text under the user cursor. so far I managed to find only the controller ID which under the cursor this way cursorID = win32gui.WindowFromPoint(win32gui.GetCursorPos()) their is function called GetWindowText I tried to use but it doesn't work in most of the time someone know a way to do this? thank you! -- http://mail.python.org/mailman/listinfo/python-list
Re: win32gui
thank you I'm checking autoit documentation... -- http://mail.python.org/mailman/listinfo/python-list
loops
how can I do width python a normal for loop width tree conditions like for example : for x=1;x<=100;x+x: print x thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: loops
On Oct 18, 12:39 pm, Duncan Booth <[EMAIL PROTECTED]> wrote: > Gandalf <[EMAIL PROTECTED]> wrote: > > how can I do width python a normal for loop width tree conditions like > > for example : > > > for x=1;x<=100;x+x: > > print x > > What you wrote would appear to be an infinite loop so I'll assume you meant > to assign something to x each time round the loop as well. The simple > Python translation of what I think you meant would be: > > x = 1 > while x <= 100: > print x > x += x > > If you really insist on doing it with a for loop: > > def doubling(start, limit): > x = start > while x <= limit: > yield x > x += x > > ... > > for x in doubling(1, 100): > print x I was hopping to describe it with only one command. most of the languages I know use this. It seems weird to me their is no such thing in python. it's not that I can't fined a solution it's all about saving code -- http://mail.python.org/mailman/listinfo/python-list
Re: loops
On Oct 18, 12:39 pm, Duncan Booth <[EMAIL PROTECTED]> wrote: > Gandalf <[EMAIL PROTECTED]> wrote: > > how can I do width python a normal for loop width tree conditions like > > for example : > > > for x=1;x<=100;x+x: > > print x > > What you wrote would appear to be an infinite loop so I'll assume you meant > to assign something to x each time round the loop as well. The simple > Python translation of what I think you meant would be: > > x = 1 > while x <= 100: > print x > x += x > > If you really insist on doing it with a for loop: > > def doubling(start, limit): > x = start > while x <= limit: > yield x > x += x > > ... > > for x in doubling(1, 100): > print x thanks -- http://mail.python.org/mailman/listinfo/python-list
indentation
every time I switch editor all the script indentation get mixed up, and python start giving me indentation weird errors. indentation also hard to follow because it invisible unlike brackets { } is there any solution to this problems? thank you! -- http://mail.python.org/mailman/listinfo/python-list
py2exe
I'm new to py2exe. i'm using python 2.5 on XP and py2exe 0.6.6 does someone know what may be wrong with this script: from distutils.core import setup import py2exe setup(console=['babylon.py'], options = { "py2exe": { "packages": ["pyHook", "encodings", "pywinauto", "pywinauto.controls", "pywinauto.tests", "urllib2", "pyTTS"], "excludes" : ["sendkeys"], } } ) if you need more information please tell me... thank you -- http://mail.python.org/mailman/listinfo/python-list
Re: py2exe
OK this question is not clear enough. I'm trying to convert my python script to executable file. it seems than the simple setup(console=['file.py']) won't work in my case because i use unsupported modules (like pywinauto and extra). this are the modules I import: import wx import wx.html as html import pythoncom, pyHook from pywinauto import win32defines from pywinauto.controls.HwndWrapper import win32functions from pywinauto.controls.HwndWrapper import HwndWrapper from pywinauto.controls.HwndWrapper import win32structures from pywinauto.controls.HwndWrapper import time from pywinauto.controls.HwndWrapper import Timings from pywinauto.controls.HwndWrapper import ctypes from pywinauto import win32defines from pywinauto import win32functions from pywinauto.controls.HwndWrapper import SendKeys import sys import urllib2 import re import pywinauto.clipboard import sqlite3 as lite import time import pyTTS can someone please show me the right way to right write my setup.py script? thank you! -- http://mail.python.org/mailman/listinfo/python-list
WXpython Question
I try to reach a specific wx StaticText element's text and to change it by clicking on a button now let's say the this is my element: wx.StaticText(panel, 15, "Hello" ,(30, 70) , style=wx.ALIGN_CENTRE) And this is my EVT_BUTTON bind function : def OnClick(event): which code shude i enter to change "hello" to "goodbay"? thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: WXpython Question
On May 23, 3:29 pm, Mike Driscoll <[EMAIL PROTECTED]> wrote: > On May 23, 8:24 am, Gandalf <[EMAIL PROTECTED]> wrote: > > > I try to reach a specific wx StaticText element's text and to change > > it by clicking on a button > > > now let's say the this is my element: > > > wx.StaticText(panel, 15, "Hello" ,(30, 70) , style=wx.ALIGN_CENTRE) > > > And this is my EVT_BUTTON bind function : > > > def OnClick(event): > > > which code shude i enter to change "hello" to "goodbay"? > > > thanks > > You're probably looking for SetLabel(). So if you do something like > this to instantiate the StaticText: > > self.myText = wx.StaticText(panel, 15, "Hello" ,(30, 70) , > style=wx.ALIGN_CENTRE) > > Then you can change your text by adding this to your OnClick event > handler: > > self.myText.SetLabel("goodbye") > > Have fun! And remember, there's a great wxPython mailing list too: > > http://www.wxpython.org/maillist.php > > Mike Thanks! -- http://mail.python.org/mailman/listinfo/python-list
Another Question
How can i bind function that handle the mouse clicking window X event or clicking alt+F4 thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: Another Question
On May 23, 6:25 pm, Mike Driscoll <[EMAIL PROTECTED]> wrote: > On May 23, 10:45 am, Gandalf <[EMAIL PROTECTED]> wrote: > > > How can i bind function that handle the mouse clicking window X event > > or clicking alt+F4 > > > thanks > > You really need to learn to ask good questions. Unless people dive > into your previous posts, they won't know what Python GUI toolkit you > are using, which version of said toolkit, which Python or which OS. > > Here's a good place to read about events in general: > > http://wiki.wxpython.org/EventPropagation > > If you use Google, you can look for the close event, which gives you > this: > > http://www.wxpython.org/docs/api/wx.CloseEvent-class.html > > So you'll want to bind your frame to EVT_CLOSE. You can disable the > "X" in your frame's window by using non-standard style parameters. > > Mike OK you right. I use WX on windows XP. I didn't understood how to use this wx.CloseEvent function. i really struggle with my poor english to understand this language, so your help is crucial for my progress and i appreciate it Thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: Another Question
you've been very helpful but still i have only one problem. I wont the window not to be close after clicking the X button. I wont the program to stay on the toolbar thanks! -- http://mail.python.org/mailman/listinfo/python-list
Re: Another Question
On May 23, 10:47 pm, Mike Driscoll <[EMAIL PROTECTED]> wrote: > On May 23, 1:44 pm, Gandalf <[EMAIL PROTECTED]> wrote: > > > you've been very helpful but still i have only one problem. I wont the > > window not to be close after clicking the X button. > > I wont the program to stay on the toolbar > > > thanks! > > Well then, in your event handler, just don't do anything. > > def onClose(self, event): > pass > > or maybe you want to hide the frame? > > def onClose(self, event): > self.frame.Hide() > > Just make sure you give the user some other way to close it and in > that handler, you'll need to call self.frame.Destroy(). > > Alternatively, you can just tell the frame not to create the "X" > button: > > self.frame = wx.Frame(None, -1, title="My Frame", > style=wx.SYSTEM_MENU) > > However, that makes it pretty annoying to close. > > Mike OK the first method still didn't work. no matter what i do the window keep closing but the last one worked nice and all the top menu disappear thanks! -- http://mail.python.org/mailman/listinfo/python-list
About events
As i said before I work with the WX library on a windows XP operation system. Now i wont to create an application which ran at the background and wait till the user double click on a text word OF any other python or none python application which ran on the desktop, and when this event append i wont my application to pup up a translation of this word. I figured that I need to understand how can i select text automaticlly and copy it to the clipbord for doing that if someone know how to do it, or know whether this WX library capable of doing it (and if not which library can...) i would be very thankful Have a nice day -- http://mail.python.org/mailman/listinfo/python-list
question
how do i write this code in order for python to understand it and print me the x variable x=1 def (): x++ if x > 1: print "wrong" else : print x () -- http://mail.python.org/mailman/listinfo/python-list
Re: question
On May 30, 12:14 am, John Henderson <[EMAIL PROTECTED]> wrote: > Gandalf wrote: > > how do i write this code in order for python to understand it > > and print me the x variable > > > x=1 > > def (): > > x++ > > if x > 1: > > print "wrong" > > else : > > print x > > > () > > Example: > > x=1 > def (x): > x += 1 > if x > 1: > return "wrong" > else : >return x > > print (x) > > John mmm isn't their any global variable for functions? -- http://mail.python.org/mailman/listinfo/python-list
As I promised couple of day a go
When we discuss a global window events. and i wanted to generate event when the user click on a key out of my application. I promised that if will found how to do it i'l show you. I found this article which explain very simply how to hook py width pyHook lib http://mindtrove.info/articles/monitoring-global-input-with-pyhook/ now the following code combine between wxpython and phHook. I know this code probably looks not efficient and unorganized. I'm really new width this stuff, but it works fine. before you try it you better install the pyHook from the following link http://mindtrove.info/articles/monitoring-global-input-with-pyhook/ *note theirs an image url you would have to edit in order for it to be work #!/usr/bin/python # menu1.py import wx import wx.html as html import pythoncom, pyHook class MyFrame(wx.Frame): def __init__(self, parent, id, title): wx.Frame.__init__(self, parent, id, title, wx.DefaultPosition, wx.Size(400, 400)) self.SetBackgroundColour('#fef9d8') panel= wx.Panel(self, -1, style=wx.SIMPLE_BORDER, size=(400, 100)); aaa= html.HtmlWindow(panel, -1, style=wx.SIMPLE_BORDER, size=(250, 60)) aaa.LoadPage('aa.html') cnrl=wx.TextCtrl(aaa, 11, '', (20, 20), (120, 20)) wx.Button(aaa, 12, "Translate", (160, 19)) self.Bind(wx.EVT_BUTTON, self.OnClick, id=12) quite = wx.BitmapButton(panel, 20, wx.Bitmap('py/x.gif'),(370, 0), (20, 20), style=wx.ALIGN_RIGHT ) self.Bind(wx.EVT_BUTTON, self.Yehuda, id=20) self.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown) self.SetFocus() font1= wx.Font(12, wx.NORMAL, wx.NORMAL, wx.BOLD) font2=wx.Font(10, wx.NORMAL, wx.NORMAL, wx.NORMAL) text1=wx.StaticText(panel, 15, "Hello" ,(30, 70) , style=wx.ALIGN_CENTRE) text1.SetFont(font1) text2=wx.StaticText(panel, -1, "Peace, By, Good by", (30, 100), style=wx.ALIGN_CENTRE ) text2.SetFont(font2) self.Show() self.Centre() def Yehuda(self, event): self.Hide() def OnKeyDown(self, event): keycode = event.GetKeyCode() if keycode == wx.WXK_ESCAPE: ret = wx.MessageBox('Are you sure to quit?', 'Question', wx.YES_NO | wx.NO_DEFAULT, self) if ret == wx.YES: self.Close() event.Skip() def OnClick(self,event): text1.SetLabel(cnrl.GetValue()) def OnPaint(self, event): dc = wx.PaintDC(frame) dc.DrawBitmap(frame.bitmap, 20, 20) class MyTaskBarIcon(wx.TaskBarIcon): def __init__(self, frame): wx.TaskBarIcon.__init__(self) self.frame = frame self.SetIcon(wx.Icon('menu1.png', wx.BITMAP_TYPE_PNG)) self.Bind(wx.EVT_MENU, self.OnTaskBarActivate, id=1) self.Bind(wx.EVT_MENU, self.OnTaskBarDeactivate, id=2) self.Bind(wx.EVT_MENU, self.OnTaskBarClose, id=3) #self.frame.Bind(wx.EVT_CLOSE, self.OnClose) def CreatePopupMenu(self): menu = wx.Menu() menu.Append(1, 'Show') menu.Append(2, 'Hide') menu.Append(3, 'Close') return menu def OnTaskBarClose(self, event): self.frame.Close() def OnTaskBarActivate(self, event): if not self.frame.IsShown(): self.frame.Show() def OnTaskBarDeactivate(self, event): if self.frame.IsShown(): self.frame.Hide() def OnKeyboardEvent(event): global x, frame, frame2 if event.KeyID == 162: if x==1: frame.Close() frame2= MyFrame(None, -1, 'frame') x=0 else: frame2.Close() frame= MyFrame(None, -1, 'frame2') x=1 x=1 app = wx.App() frame = MyFrame(None, -1, 'Babylon') frame.tskic = MyTaskBarIcon(frame) frame.Show(True) app.SetTopWindow(frame) hm = pyHook.HookManager() hm.KeyDown = OnKeyboardEvent hm.HookKeyboard() pythoncom.PumpMessages() app.MainLoop() -- http://mail.python.org/mailman/listinfo/python-list
Generating event from event
I have script which being triggered by pressing CTRL+Right mouse click from any place in my O.P , Now I need to generate automatically event like copy my selected item or double clicking the right mouse cursor without user interfering. how can i implement this width python? thanks! -- http://mail.python.org/mailman/listinfo/python-list
Re: Generating event from event
On May 30, 3:43 pm, Larry Bates <[EMAIL PROTECTED]> wrote: > Gandalf wrote: > > I have script which being triggered by pressing CTRL+Right mouse click > > from any place in my O.P , Now I need to generate automatically event > > like copy my selected item or double clicking the right mouse cursor > > without user interfering. > > how can i implement this width python? > > > thanks! > > You didn't tell us enough to answer your question. What GUI are you > using? Nearly every one of them that I'm aware of allow you to register > handlers for such events. > > -Larry windows xp -- http://mail.python.org/mailman/listinfo/python-list
Re: Generating event from event
Hi Diez, I can't see how it matter which GUI-Toolkit i uses because I can combine libraries. I think all that matter is that i work with windows XP. if you ever done something like that or you familiar with article which can show me how to implement what I asked it would help me Thank you very much -- http://mail.python.org/mailman/listinfo/python-list
Need Tutorial For the following lib
Hi every one. I need comprehensive tutorial for the following library : 1. pyWinAuto 2. winGuiAuto Thanks in advance -- http://mail.python.org/mailman/listinfo/python-list
Re: Need Tutorial For the following lib
Hi scott, you couldn't be more wrong about my laziness. I straggle with my poor English for hours to fined what I'm looking for. I found a very simple and not comprehensive tutorial for the pyWinAuto lib in this address http://pywinauto.openqa.org/ but it only show how to do the basic, and my knowledge at this point is not enough to figure the rest I need to know by myself I found another simple lib for the watsup that based on winGuiAuto lib in this address http://www.tizmoi.net/watsup/intro.html But for some risen I couldn't manage to ran it in my computer I'm trying to generate auto mouse double click or auto selecting text (the selecting text part is the one I interest in. mouse double click just do the same effect if the mouse cursor is on text) I'm sorry you feel I'm lazy. The truth is that event writing this message takes me an enormous power. weather you choose to help me or not I still going to keep trying , But you have the opportunity to save me lots of trouble, So maybe one day I could help others. so if you familiar with any good tutorial for this library please let me know and if not then thank you anyway for wonting to help Y.G -- http://mail.python.org/mailman/listinfo/python-list
Re: Need Tutorial For the following lib
On Jun 1, 1:41 pm, Larry Bates <[EMAIL PROTECTED]> wrote: > Gandalf wrote: > > Hi scott, you couldn't be more wrong about my laziness. I straggle > > with my poor English for hours to fined what I'm looking for. > > I found a very simple and not comprehensive tutorial for the pyWinAuto > > lib in this addresshttp://pywinauto.openqa.org/ > > but it only show how to do the basic, and my knowledge at this point > > is not enough to figure the rest I need to know by myself > > I found another simple lib for the watsup that based on winGuiAuto > > lib in this address > >http://www.tizmoi.net/watsup/intro.html > > But for some risen I couldn't manage to ran it in my computer > > > I'm trying to generate auto mouse double click or auto selecting text > > (the selecting text part is the one I interest in. mouse double click > > just do the same effect if the mouse cursor is on text) > > > I'm sorry you feel I'm lazy. The truth is that event writing this > > message takes me an enormous power. > > weather you choose to help me or not I still going to keep trying , > > But you have the opportunity to save me lots of trouble, So maybe one > > day I could help others. > > > so if you familiar with any good tutorial for this library please let > > me know and if not then thank you anyway for wonting to help > > > Y.G > > What you want is an easy solution to what isn't an easy problem, but (as with > your other post) you refuse to provide enough information to allow us to help > you. If I were you, I would download wxPython and go through the demos that > it > includes. comp.python.wxpython list is excellent (at least as good as this > one) > for any follow-up questions. Windows events and mouse clicks are going to > take > a concerted effort (on your part) to learn (especially if you haven't > accomplished such a task in another language). > > -Larry Hi, Larry. thank you for your interaction. I did manage to do half of the things I was asking you about them. I manage to create an application which react to a mouse and keyboard events that occur anywhere in the O.P (that done easily by the phHook library here http://mindtrove.info/articles/monitoring-global-input-with-pyhook/#toc-references ) And I manage to find lib which auto generate event they event show you with video how simple it's to get done http://pywinauto.openqa.org/ and this is the video. it's interesting http://showmedo.com/videos/video?name=UsingpyWinAutoToControlAWindowsApplication&fromSeriesID=7 The only problem is that they show only how to automatically open notepad. they have this DoubleClick method as I saw in the documentation (i think this is what I'm looking for) but they don't show how to use it. I'm telling you that because I believe it's not as complex as you think it is. I think I'm close. if i could just fine a manual which show more examples or a bit more information i can do this. Thank you -- http://mail.python.org/mailman/listinfo/python-list
a python phpmyadmin like program
is their any graphic program for handling sqlite like phpmyadmin or access in python? thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: a python phpmyadmin like program
On Jun 3, 11:53 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > Gandalf schrieb: > > > is their any graphic program for handling sqlite like phpmyadmin or > > access in python? > > rekall? > > Diez mmm, for windows... ? -- http://mail.python.org/mailman/listinfo/python-list
how should i use this function?
http://aspn.activestate.com/ASPN/docs/ActivePython/2.2/PyWin32/PyCRichEditCtrl__GetSelText_meth.html GetSelText() I tried to import win32ui.PyCRichEditCtrl, But the shell told me their's no such module. If anyone can show me an example it would be great Thanks! -- http://mail.python.org/mailman/listinfo/python-list
Re: how should i use this function?
On Jun 4, 8:21 pm, sturlamolden <[EMAIL PROTECTED]> wrote: > On Jun 4, 8:14 pm, Gandalf <[EMAIL PROTECTED]> wrote: > > > I tried to import win32ui.PyCRichEditCtrl, But the shell told me > > their's no such module. > > There isn't, as it is a class. win32ui is a module. If you cannot > import that, you don't have pywin32 installed. Go get it from > Sourceforge. But I pywin32 use it all the time i have pywinauto -- http://mail.python.org/mailman/listinfo/python-list
Re: how should i use this function?
On Jun 4, 11:46 pm, "David C. Ullrich" <[EMAIL PROTECTED]> wrote: > In article > <[EMAIL PROTECTED]>, > > Gandalf <[EMAIL PROTECTED]> wrote: > > On Jun 4, 8:21 pm, sturlamolden <[EMAIL PROTECTED]> wrote: > > > On Jun 4, 8:14 pm, Gandalf <[EMAIL PROTECTED]> wrote: > > > > > I tried to import win32ui.PyCRichEditCtrl, But the shell told me > > > > their's no such module. > > > > There isn't, as it is a class. win32ui is a module. If you cannot > > > import that, you don't have pywin32 installed. Go get it from > > > Sourceforge. > > > But I pywin32 use it all the time i have pywinauto > > And, as I seem to recall someone saying once, win32ui.PyCRichEditCtrl > is not a module so you can't import it. You can say > > from win32ui import PyCRichEditCtrl > > Or you can say > > import win32ui > > and then reference win32ui.PyCRichEditCtrl . > > -- > David C. Ullrich OK you right, but it still doesn't work. PyCRichEditCtrl is probably not the correct object -- http://mail.python.org/mailman/listinfo/python-list
sendKey
I found some script that send keys , But I couldn't manage to send CTRL+c with none of them can any one tell me what i'm doing wrong: import win32api import win32com.client shell = win32com.client.Dispatch("WScript.Shell") shell.Run("Notepad") win32api.Sleep(100) shell.AppActivate("Notepad") win32api.Sleep(100) shell.SendKeys("112435435") win32api.Sleep(100) shell.SendKeys("^a") # that wouldn't select all win32api.Sleep(100) shell.SendKeys("^c")# that wouldn't copy import SendKeys SendKeys.SendKeys("""^c""") Thank you! -- http://mail.python.org/mailman/listinfo/python-list
SQlite none english char
I works with python 2.5 on windows, And I use sqlite3 Now, I have problem searching string in Hebrew in my database I have table called "test" with field num and test firs row i insert "1" and "עברית" (that is "Hebrew" in Hebrew) second row i insert "2" and "English" now this code will print me >>> English as it should: i="Englisht" cur.execute("select * from `test` where text like '%"+i+"%' ") for row in cur: print row[1] but this one print me nothing >>> instead of עברית i="עברית" cur.execute("select * from `test` where text like '%"+i+"%' ") for row in cur: print row[1] does any one have an idea how can i solve it? -- http://mail.python.org/mailman/listinfo/python-list
Re: SQlite none english char
On Jun 8, 11:00 am, Gerhard Häring <[EMAIL PROTECTED]> wrote: > Gandalf wrote: > > I works with python 2.5 on windows, And I use sqlite3 > > > Now, I have problem searching string in Hebrew in my database > > > I have table called "test" with field num and test > > firs row i insert "1" and "עברית" (that is "Hebrew" in Hebrew) > > second row i insert "2" and "English" [...] > > I recommend you use Unicode strings for all your Python strings in the > application. You can then be that things will just work with the sqlite3 > module. > > The problem is that the sqlite3 module doesn't currently check if what > you insert into the database is in UTF-8 encoding. But if it isn't, > you're likely to run into problems later on. > > So, let's assume that you've written your Python using a UTF-8 editor, > you can then use something like: > > # coding: utf-8 > > as the first line in the script. Among others, this will allow you to > write Unicode literals in UTF-8, i. e. do something like: > > data = u"עברית". > > then you can insert this into the database: > > cur.execute("insert into test(test) values (?)", (data,)) > > Note that I use the parametrized form of execute() with ? as > placeholders. *Always* use this when the SQL statement is not constant, > but has parameters of some sort. > > > [...] > > cur.execute("select * from `test` where text like '%"+i+"%' ") > > for row in cur: > > print row[1] > > > but this one print me nothing > > instead of עברית > > This could be two problems. Either (likely) it simply isn't found > because you inserted garbage (non-UTF-8 data) or you got a decoding > error to UTF-8 executing the select, which the sqlite3 module will > currently unfortunately ignore and return a None value instead. > > Again, use the parametrized form of the execute() statement with Unicode > Python strings to avoid any problems. > > cur.execute("select * from test where text like '%' || ? || '%'", > (searchstr,)) > > !!! Ok, I just found out that you used the + operator in SQL to > concatenate strings. Don't, as it will not work (except on maybe MySQL). > Use the || operator instead! > > Note that when you use cur.execute(sql, params), then params is actually > a tuple of parameters. In the above examples there was only one > parameter, so it was a one-tuple, which is written as (element,). > Dont'write it as (element), because Python will not recognize it as a > tuple then. > > Don't hesitate to ask if you need further help. > > -- Gerhard I solved the problem by entering data manually but now the problem is that i had to delete this function: con.text_factory = str and now I can't see the data that I entered thought my sqlite manager -- http://mail.python.org/mailman/listinfo/python-list
mysql to sqlite
I'm trying to convert mysql database to sqlite. is their any free tool that does that? I can convert my mysql db to XML file through phpmyadmin, will it be easier to convert from XML to SQlite then from Mysql? -- http://mail.python.org/mailman/listinfo/python-list
convert sqlite ANSI to UTF-8
I used sqliteadmin to manage my sqlite database and I copy past queries translated from mysql phpmyadmin output it worked (little slowly but worked...), the only problem now is that sqliteadmin stored my hebrew char as ANSI instead of UTF-8 and now I don't know how to search data from this table. How can I convert my database string from ANSI to UTF-8 Thanks! -- http://mail.python.org/mailman/listinfo/python-list
Charset (hopefully for the last time I ask)
now I understand my problem better so their is a good chance you manage to help me. I have a SQlite database full with ANSI Hebrew text , and program that uses WXpython Now, I use a- 'wx.TextCtrl' item to receive input from the user, and when I try to search the database he don't understand this chars. it's quite reasonable consider the fact the program set to work on UTF-8 charset, except for: 1. it doesn't work when I delete the charset too 2. when I try to use function like decode and encode it output error like this: ascii' codec can't encode characters in position 0-4: ordinal not in range(128) ascii' codec can't encode characters in position 0-2: ordinal not in range(128) 3. I don't know how to translate my DB from ANSI to UTF-8 4. when I don't use the user WX items input I can change my editor charset to ansi and it works fine Thank you all -- http://mail.python.org/mailman/listinfo/python-list
Re: Charset (hopefully for the last time I ask)
Yes, it is 1255 it's surprising you know that. any way this is the code I tried search=cnrl.GetValue() search= search.decode("cp1255") search=search.encode("utf8") word='' category=1 cur.execute('select * from hebrew_words where word like ?', [''+search+'']) this is the error it send me : 'ascii' codec can't encode characters in position 0-1: ordinal not in range(128) have any idea? Thank you for trying any way. it worms my Jewish art :) -- http://mail.python.org/mailman/listinfo/python-list
Re: Charset (hopefully for the last time I ask)
OK it did worked! I just should have been encoding to cp1255 search=cnrl.GetValue() search= search.encode("cp1255") cur.execute('select * from hebrew_words where word like ?', ['%'+search+'%']) Thank you! you are the best -- http://mail.python.org/mailman/listinfo/python-list
Setting Focus
You know these application like ICQ or winamp which stay at the front of the desktop as long as the user doesn't minimize it. I wont to do the same with my application in python. I still didn't manage to make pywinauto to auto set my window frame in focus reliability so I was hoping this will solve my problem. I'm working with WX lib on 2.5 python on Microsoft Windows XP if any one {know / heard /think he know /thunk he heard/ sow once article that shows} how to do it I will be happy to know thank you in advance -- http://mail.python.org/mailman/listinfo/python-list
text alignment
Hi every one. What is the similar python WX style property for CSS text-align? I need this item text to start from the right direction: aaa= html.HtmlWindow(self, -1, style=wx.SIMPLE_BORDER, size=(250, 60)) aaa.LoadPage('../../aa.html') Thanks! -- http://mail.python.org/mailman/listinfo/python-list
Re: text alignment
On Jun 17, 6:43 pm, Gandalf <[EMAIL PROTECTED]> wrote: > Hi every one. What is the similar python WX style property for CSS > text-align? > > I need this item text to start from the right direction: > > aaa= html.HtmlWindow(self, -1, style=wx.SIMPLE_BORDER, size=(250, 60)) > aaa.LoadPage('../../aa.html') > > Thanks! *right to the left direction... And I'm using pythin 2.5 on XP (I forget to mention...) -- http://mail.python.org/mailman/listinfo/python-list
Re: text alignment
On Jun 17, 7:49 pm, Mike Driscoll <[EMAIL PROTECTED]> wrote: > On Jun 17, 11:45 am, Gandalf <[EMAIL PROTECTED]> wrote: > > > On Jun 17, 6:43 pm, Gandalf <[EMAIL PROTECTED]> wrote: > > > > Hi every one. What is the similar python WX style property for CSS > > >text-align? > > > > I need this item text to start from the right direction: > > > > aaa= html.HtmlWindow(self, -1, style=wx.SIMPLE_BORDER, size=(250, 60)) > > > aaa.LoadPage('../../aa.html') > > > > Thanks! > > > *right to the left direction... > > > And I'm using pythin 2.5 on XP (I forget to mention...) > > The HtmlWindow widget can only display simple html. So, while you > cannot use CSS, you should be able to use the simple html alignment > directives. Check out the following site for pointers: > > http://www.htmlite.com/lite008.php > > If you want to be able to use CSS and javascript, you'll want to use > the ActiveX_IEHtmlWindow (wx.lib.iewin) widget instead as it embeds > Internet Explorer. > > Mike well thanks it seems useful... My question is about general items in WX and how to position them inside an element without using CSS. It's only coincidence My item is HtmlWindow -- http://mail.python.org/mailman/listinfo/python-list
Re: text alignment
since you brought up this issue, please tell me where can I fine menual for this library? can i generate dynamic GUI from it? If not, Is there any way to generate dynamic GUI (one that can change according to the user input) with HTML-CSS- javascript similar environment? -- http://mail.python.org/mailman/listinfo/python-list
Re: text alignment
On Jun 17, 8:43 pm, Mike Driscoll <[EMAIL PROTECTED]> wrote: > On Jun 17, 1:20 pm, Gandalf <[EMAIL PROTECTED]> wrote: > > > since you brought up this issue, please tell me where can I fine > > menual for this library? > > You want the manual for wxPython? Go to the download page on the > Official wxPython page and get the Docs & Demos > package:http://wxpython.org/download.php > > That include the wxWidgets Reference. Also > see:http://wxpython.org/onlinedocs.php > > > can i generate dynamic GUI from it? > > Not sure what you mean by this. If you know how to create a "dynamic > GUI" with html/ajax or some such based on the user's interactions with > your website, than it should work in the embedded browser just as well > as it would in a non-embedded one. > > > If not, Is there any way to generate dynamic GUI (one that can change > > according to the user input) with HTML-CSS- javascript similar > > environment? > > Mike Hi Mike, I was referring to the ActiveX_IEHtmlWindow which you talked about, when I asked you for a tutorial. I have lots of experience on developing web application so if I could implement some of my knowledge for developing none web application it can save me trouble thanks -- http://mail.python.org/mailman/listinfo/python-list
pyHook and py2exe
hi every one. I have program which uses this pyHook lib, and when I try to compile it using py2exe the pyhook don't work. it gives me no error. the program works fine beside the function of this lib. why does it append ? is their any solution? I would be glad to know if anyone ever experienced this problem and if he solve it eventually thanks -- http://mail.python.org/mailman/listinfo/python-list
Notice For All pyHook users
If you want to compile your program the new py2exe release 0.6.8 wont work! the pyhook function will be ignored you'll have to uninstall the 0.6.8 version and to install the 0.6.6 instead it took me 2 days to find the solution. maybe some day someone will bump the same problem and find this message through google -- http://mail.python.org/mailman/listinfo/python-list
sqlite3 alternative option
Hi every one I'm looking for a good alternative db to replace sqlite I'm using pySQlite3, And I tried to translate very big database from Mysql to sqlite. I generated through PHP a python script that insert 200,000 records to my sqlite db and took me more then 5 hours and managed to insert only 100,000 records. I have almost million records so I need a better solution. thank you -- http://mail.python.org/mailman/listinfo/python-list
Re: sqlite3 alternative option
you where right! thank you ! -- http://mail.python.org/mailman/listinfo/python-list
Simple question
I use to write code with PHP. To ran script width PHP I need to open new file inside my WWW directory and name it somethin.php and then to write my script inside tags how can i ran script with python thenks -- http://mail.python.org/mailman/listinfo/python-list
Re: Simple question
On May 10, 2:36 pm, Bjoern Schliessmann wrote: > Gandalf wrote: > > how can i ran script with python > > It depends on your web server configuration. To get your web server > execute Python code, there are several alternatives like > > * CGI > * FastCGI > * mod_python > > Regards, > > Björn > > -- > BOFH excuse #93: > > Feature not yet implemented my server is my computer and all i did way to install python on it. -- http://mail.python.org/mailman/listinfo/python-list
Re: Simple question
Thanks guys I think you miss understood me. i have been mining to use python to create a none web application. And i found out that i can ran python scripts by calling them from CMD or just raning them from windows -- http://mail.python.org/mailman/listinfo/python-list
list object
my manual contain chapter about lists with python. when i try to copy paste : li = ["a", "b", "mpilgrim", "z", "example"] (1) it i get this errore: "TypeError: 'list' object is not callable" i was wondering if their is any special module I should import before i use this function i know i ask foolish questions it's my first day with python and i have experience only with PHP and javascript, so please be patient thanks -- http://mail.python.org/mailman/listinfo/python-list
wx scroll bar
Hi every one. I'm not sure whether my framework is relevant so i will mention it any way. windows XP python 2.5.2 wx 2.8 something... I'm trying to scroll a panel element and it doesn't work. (maybe this function doesn't supposed to scroll element like this) this is the relevant code: wx.Frame.__init__(self, parent, id, title, size=(500, 400)) panel1=wx.Panel(self, -1, style=wx.SIMPLE_BORDER, size=(400, 460)); panel1.SetBackgroundColour('#cce8fa') sw = wx.ScrolledWindow(panel1) sw.SetScrollbars(20,20,55,40) if any one know how should i do it I will be extremely thankful thanks! -- http://mail.python.org/mailman/listinfo/python-list
Re: wx scroll bar
On Aug 21, 2:42 pm, Gandalf <[EMAIL PROTECTED]> wrote: > Hi every one. I'm not sure whether my framework is relevant so i will > mention it any way. > windows XP > python 2.5.2 > wx 2.8 something... > > I'm trying to scroll a panel element and it doesn't work. (maybe this > function doesn't supposed to scroll element like this) > > this is the relevant code: > wx.Frame.__init__(self, parent, id, title, size=(500, 400)) > panel1=wx.Panel(self, -1, style=wx.SIMPLE_BORDER, size=(400, 460)); > panel1.SetBackgroundColour('#cce8fa') > sw = wx.ScrolledWindow(panel1) > > sw.SetScrollbars(20,20,55,40) > > if any one know how should i do it I will be extremely thankful > > thanks! OK I solved it. if any one ever bump the same problem panel1.SetScrollbar(wx.VERTICAL, 0, 6, 50); -- http://mail.python.org/mailman/listinfo/python-list
Question about wx BoxSizer background
I'm creating a table with gridSizer, and I'm trying to set cell background like I use to do with HTML so I tried this: BoxName =wx.BoxSizer(wx.HORIZONTAL) BoxName.SetBackgroundColour('#cce8fa') and it told me their is no sauce function so what is the right way to do it? thanks! -- http://mail.python.org/mailman/listinfo/python-list
Re: Question about wx BoxSizer background
thanks! -- http://mail.python.org/mailman/listinfo/python-list
gridSizer inside a panel element
why when I try to insert gridSizer to a panel which already inside another panel the gridSizer doesn't work? this is the code: panel3= wx.Panel(self, -1, (0, 60), size=(400, 240) , style=wx.SIMPLE_BORDER); panel3.SetBackgroundColour('#dadadb') panel = wx.Panel(panel3, wx.ID_ANY, style=wx.SIMPLE_BORDER, size=(150, 60)) panel.SetBackgroundColour("#fffFFF") bmp = wx.ArtProvider.GetBitmap(wx.ART_TIP, wx.ART_OTHER, (16, 16)) inputIco = wx.StaticBitmap(panel, wx.ID_ANY, bmp) labelThree= wx.StaticText(panel, wx.ID_ANY, 'Hello') label2=wx.StaticText(panel, wx.ID_ANY, 'Pease, Quite, Hello, Shalom') topSizer = wx.BoxSizer(wx.VERTICAL) gridSizer = wx.GridSizer(rows=2, cols=1, hgap=5, vgap=5) input = wx.BoxSizer(wx.HORIZONTAL) output = wx.BoxSizer(wx.HORIZONTAL) input.Add((20,20), 1, wx.EXPAND) # this is a spacer input.Add(inputIco, 0, wx.ALL, 5) input.Add(labelThree, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5) output.Add((20,20), 1, wx.EXPAND) # this is a spacer output.Add(label2, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5) gridSizer.Add(input, 0, wx.ALIGN_LEFT) gridSizer.Add(output, 0, wx.ALIGN_RIGHT) topSizer.Add(gridSizer, 0, wx.ALL|wx.EXPAND, 5) panel.SetSizer(topSizer) -- http://mail.python.org/mailman/listinfo/python-list
A variables variables
how can I declare a variable with another variable name? for example I will use PHP: $a= "hello"; $a_hello="baybay"; print ${'a_'.$a) //output: baybay how can i do it with no Arrays using python thanks! -- http://mail.python.org/mailman/listinfo/python-list
Re: A variables variables
OK thank you all ! sometimes you just getting use to somethings... -- http://mail.python.org/mailman/listinfo/python-list
boxsizer inside a panel
the following code's panel elements doesn't react like a table though is haze boxsizer What is wrong here? : panel3=wx.Panel(self,-1,(10,10), style=wx.SIMPLE_BORDER, size=(370, 150)) panel3.SetBackgroundColour("#ff") text1=wx.StaticText(panel3, -1, 'Hello') text2=wx.StaticText(panel3, -1, 'text text text text') box = wx.BoxSizer(wx.HORIZONTAL) box.Add(text1, 1, wx.ALIGN_LEFT) box.Add(text2, 1, wx.ALIGN_RIGHT) self.SetAutoLayout(True) panel3.SetSizer(box) self.Layout() thanks! -- http://mail.python.org/mailman/listinfo/python-list
scroll bar
why this code is no giving any scroll? -- http://mail.python.org/mailman/listinfo/python-list
Re: scroll bar
forgot the code, sorry, the code: import wx class MyFrame(wx.Frame): def __init__(self, parent, ID, title): wx.Frame.__init__(self, parent, ID, title, size=(400, 250)) myscrolledwindow = wx.PyScrolledWindow(self, -1) sizer = wx.BoxSizer() myscrolledwindow.SetSizer(sizer) myscrolledwindow.SetScrollRate(1,1) app = wx.PySimpleApp() frame = MyFrame(None, -1, "Sizer Test") frame.Show() app.MainLoop() -- http://mail.python.org/mailman/listinfo/python-list
encoding
if i want to print utf-8 string i should writre: print u"hello word" but what happen if i want to print variable? thank you -- http://mail.python.org/mailman/listinfo/python-list
Re: encoding
On Sep 1, 11:59 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > Gandalf schrieb: > > > if i want to print utf-8 string i should writre: > > > print u"hello word" > > No, you don't. You write > > print u"hello world".encode("utf-8") > > Read this: > > http://www.reportlab.com/i18n/python_unicode_tutorial.html > > > but what happen if i want to print variable? > > Then you do > > print variable_containing_unicode_object.encode("utf-8") > > Diez thanks -- http://mail.python.org/mailman/listinfo/python-list
Right to left language support
Most of you probably speaks Latin language, so you wont understand the problem. when I try to write Hebrew in my statictext the last punctuation marks get mixed up. does someone have a solution for this? this is the code : text=wx.StaticText(panel3, -1, Hebrew_string, style=wx.ALIGN_RIGHT) thanks! -- http://mail.python.org/mailman/listinfo/python-list
Re: security quirk
RichD contributed wisdom to news:b968c6c6-5aa9- 4584-bd7a-5b097f17c...@pu9g2000pbc.googlegroups.com: > Web gurus, what's going on? > That is the fault of the site itself. If they are going to block access to users then they should also block access to the automated spiders that hit the site to collect data. -- http://mail.python.org/mailman/listinfo/python-list
Re: security quirk
RichD contributed wisdom to news:badd4188-196b- 45e3-ba8a-511d47128...@nh8g2000pbc.googlegroups.com: > On Jan 30, Gandalf Parker > wrote: >> > Web gurus, what's going on? >> >> That is the fault of the site itself. >> If they are going to block access to users then they should also block >> access to the automated spiders that hit the site to collect data. > > well yeah, but what's going on, under the hood? > How does it get confused? How could this > happen? I'm looking for some insight, regarding a > hypothetical programmimg glitch - (from alt.hacker) You dont understand. It is not in the code. It is in the site. It is as if someone comes and picks fruit off of your tree, and you are questioning the tree for how it bears fruit. The site creates web pages. Google collects web pages. The site needs to set things like robot.txt to tell Google to NOT collect the pages in the archives. Which is not an absolute protection but at least its an effort that works for most sites. -- http://mail.python.org/mailman/listinfo/python-list
smtplib question
Hi everyone, I was trying out smtplib and found out that I can email to anyone in my domain but not to an email address not in the domain. From browsing on the web, it seems that this has to do with the configuration of the mail server. The mail server in my organization is MS exchange. Obviously I can email to any email address from my MS outlook. What's the easiest way to fix the program? Thanks. - gan import sys, smtplib fr = "[EMAIL PROTECTED]" to = "[EMAIL PROTECTED]" # will not work line = "testing" subj = "subject line" msg = "From: %s\r\nTo: %s\r\nSubject: %s\r\n\r\n%s" % (fr, to, subj, line) server = smtplib.SMTP("EXCHCLUSTER.ccis.edu") server.set_debuglevel(1) server.sendmail(fr, [to], msg) server.quit() Do you Yahoo!? Everyone is raving about the all-new Yahoo! Mail beta. http://new.mail.yahoo.com-- http://mail.python.org/mailman/listinfo/python-list