Problem with auto-selection in wx masked control
Hi all, I'm trying to get the whole field selected when the caret arrives into a wx masked control. This is perfectly done with the program below. But if I comment out the line "r= dlg.ShowModal()", I get something different : the data within the field is no more correctly selected. Why ? And is there any solution ? If somebody have got an idea, I'd be delighted. Cheers, jm # import wx from wx.lib import masked #-- class TestPanel( wx.Panel ): def __init__( self, parent): wx.Panel.__init__( self, parent, -1 ) self.mask1 = masked.NumCtrl( self, -1, name="target control", pos=(20,50)) self.mask1.SetSelectOnEntry(True) self.mask1.SetValue(123.45678) self.Show() #-- class MainWindow(wx.Frame): def __init__(self,parent,id, title): wx.Frame.__init__(self,parent,wx.ID_ANY,title,size=(200 ,200)) win = TestPanel(self) dlg = wx.MessageDialog(self, 'Confirm') r= dlg.ShowModal() dlg.Destroy() self.Show() #-- app = wx.PySimpleApp() frame=MainWindow(None,-1,'') app.MainLoop() # -- http://mail.python.org/mailman/listinfo/python-list
Re: Spanish Translation of any python Book?
Olaf "El Blanco" wrote: > Maybe there is someone that speak spanish. I need the best spanish book for > learning python. > > Thanks! > > > Hola, Conoces "La lista de python en castellano <[EMAIL PROTECTED]>" ? Si intentas preguntar a ella, se podria que haya otras respuestas que aqui. Un saludo, jm -- http://mail.python.org/mailman/listinfo/python-list
Re: can wxpython checkbox use the "fill in" marker instead of the "check"?
Hi, > does anyone know if, for a 2-state checkbox, you can use the "fill in" > marker from the 3-state checkbox, instead of a checkmark > > i just like the look of the "fill-in" instead of the checkmark Use a 3-state and change the state to 2 when you get the 1 state. Here is a working modification to the demo : if cb.Is3State(): self.log.write("\t3StateValue: %s\n" % cb.Get3StateValue()) if cb.Get3StateValue() == 1: cb.Set3StateValue(2) Regards, jm -- http://mail.python.org/mailman/listinfo/python-list
Re: can wxpython checkbox use the "fill in" marker instead of the "check"?
>> i just like the look of the "fill-in" instead of the checkmark I'm just realizing it's a good idea ! I'm going to use it. Thanks ! -- http://mail.python.org/mailman/listinfo/python-list
Re: Windows vs. Linux
Hi, [EMAIL PROTECTED] a écrit : > Is Windows > an okay enviornment in which to program under Python, or do you > recommend that I run a dual-boot of Linux or maybe a VMWare install to > program under Python? I'm used to practice windows & linux and it makes sense to use python on both because the compatibility is excellent. Take care to use os.sep as the file path separator if you plan to stay compatible. My favorite os is linux, but on windows you have pythonwin which is an excellent python extension with a very good debugger. Also boa works fine on windows but have annoying bugs on linux. Furthermore, python comes with linux (nothing to install) and not with windows (needs python install if you deploy on users pcs). Regards, jm -- http://mail.python.org/mailman/listinfo/python-list
Re: Windows vs. Linux
Andy Dingley a écrit : > I'd never recommend dual-boot for anything! Don't agree man, it's good for testing... -- http://mail.python.org/mailman/listinfo/python-list
Re: [Linux] What toolkit for a good grid/spreadsheet widget?
Hi, > Thx for the two pointers. Are those widgets more than just tables, ie. > can I edit the contents, including displaying a combo box, can items > be grouped or hierarchized, or are they just basic, read-only tables > to display results? > > I need this kind of widget to build a 2+ column interface to let users > type entries into the application as an alternative to MS Access-style > complicated entry masks. Wx have got an excellent one. I was succesful to use it with editable cells and to include a choice in a cell. However, it was pretty hard to reach that, ie to extract a working sample from the demo. Once done that, no more problems with it. What I suggest you is to have a look on the demo, in the chapter "Core Windows/Controls -> Grid -> wx.Grid showing Editors and Renderers". Rgds, jm -- http://mail.python.org/mailman/listinfo/python-list
Re: wxPython ListBook Class, Label Position w/ ImageList
Hi, > By default the label position of an image list is below the image. Is > there any way to change this? > If it exists, it's undocumented, and there is not a sample. Did you ask the wx forum ? It's probably a better place to have this kind of information. If they provide you a C sample, I could help you to convert it in python. Anyway, if you find out something, I'm interested... Regards, jm -- http://mail.python.org/mailman/listinfo/python-list
Re: can wxpython checkbox use the "fill in" marker instead of the "check"?
jean-michel bain-cornu a écrit : >>> i just like the look of the "fill-in" instead of the checkmark > I'm just realizing it's a good idea ! > I'm going to use it. Thanks ! Actually, there is a problem when one generates an exe application with py2exe. In that case, the 3rd style checkmark looks 'disabled'... which is not what we want ! The best solution I can find at the moment is to switch back to the regular style (it allways happens when you are about to deliver your stuff...), but if you are still there, you'd better think about of it... Rgds, jm -- http://mail.python.org/mailman/listinfo/python-list
Re: wxPython Grid Question
Hi, Jordan a écrit : > Hey Peoples, > I'm wonderg if there is a way to make a subclass of wx.grid.Grid in > which the coloumn labels for the grid appear on the bottom of the grid > instead of the top. > > 1 2 3 4 5 > a| | | | | | > b| | | | | | > c| | | | | | > d| | | | | | > e| | | | | | > > Just in case that wasn't clear (and because I just feel like typing > more): The above grid has labels in the normal placement. The grid > below has the labels in the places I want them. > > a| | | | | | > b| | | | | | > c| | | | | | > d| | | | | | > e| | | | | | > 1 2 3 4 5 > I don't know a regular way to do that, and may be it's not the right place to ask that, but what you'd do is to build two grids with the same layout, one at the top without the column label, and another below without data lines. It could work, but looks strange, and is probably a source of confusion for users. rgds, jm -- http://mail.python.org/mailman/listinfo/python-list
Re: wxPython Grid Question
>> I'm wonderg if there is a way to make a subclass of wx.grid.Grid in >> which the coloumn labels for the grid appear on the bottom of the grid >> instead of the top. > > follow that lead. But jean-michel has two good points: it could be > easier to use 2 grids and http://wxpython.org/maillist.php would give > you better answers :) After a while, I think in the case where you'd want to use 2 grids, it could be tricky to reproduce scrollings and events across the two grids... and there are probably other inconvenients, particularly if you include it in sizers. Its probably not a so much good point. rgds jm -- http://mail.python.org/mailman/listinfo/python-list
Re: crash in wx.TreeListCtrl SelectItem()
Hi, > I have a strange crash (segfault on FreeBSD) that I can not reliably > reproduce > and therefore unfortunately can not provide a self contained test case at the > moment. > > Here is what I do (and what works almost always, but sometimes crashes): > > 1) find an item in a wx.TreeListCtrl by its pydata (code posted to this list) > 2) if the item is found: > a) call EnsureVisible(foundItem) > b) call SelectItem(foundItem) > > The call to EnsureVisible() always returns, but SelectItem() crashes python > sometimes. > > foundItem on a crash is something like this: > _a0d0c708_p_wxTreeItemId> > > calling GetPyData(foundItem) returns the correct pydate. > > Any ideas what could be happening or how to further debug this? Try anyway to reproduce with a sample. The only way I know in this case is to split the code and see if it happens again. If so, split again, and again, and so on... It can be long, but the only way. Very often, you'll find yourself the buggy part. Once time you'll have a sample, post it, I can try on linux and windows. Also please give the versions of the softwares you use. rgds jm -- http://mail.python.org/mailman/listinfo/python-list
Re: wxpython wxgrid question
[EMAIL PROTECTED] a écrit : > Tim Roberts wrote: >> [EMAIL PROTECTED] wrote: >>> I am looking for example code that consists of just a frame and a >>> grid(10x2). The grid must fill the its parent even if the frame is >>> resized. >> Have you gone through the wxPython demo application? It contains examples >> of every standard control and almost every behavior you might want. >> -- >> - Tim Roberts, [EMAIL PROTECTED] >> Providenza & Boekelheide, Inc. > > Yes, and i have even checked out "wxpython in action". All of the > examples tend to leave white space on the right of the frame. I tried > basic a example with sizers and it didnt work. That why I was > wondering if someone had got it to work. > > >Roger > Hi Roger, A key point is that the Grid manages itself its available space according to the size it can have. If you just tried to create a simple grid within a simple frame, you probably got a grid filling all the frame space, and it's what you want. Why that ? If you do it (for instance with the script below), and you try to manually reduce/increase the size of the window, you should see scrollbars at the edge of the window ; these scrollbars come from the grid, because they take in account the labels row and col (wxGrid comes from wxScrolledWindow). You can see that no more space is available beyond the scrollbar, so the grid takes the whole space. And why the white space on the right ? This space is not on the right of the grid, but on the right of the last col. We could think it's like that because it's not possible to compute an appropriate col size for the grid cols, but it's not displayed exactly the same in linux and in windows. In one case it's over the last col (not enough space) and in the other case it's beyond (too much space). I think that as the program must work on all the environments, the interface must stay enough global, and sometimes the display is not perfectly done. The advantage is that if we let wx decide, we won't have to think how to set the widgets. Regards, jm #-- import wx,wx.grid #-- class MainWindow(wx.Frame): def __init__(self,parent,id,title): wx.Frame.__init__(self,parent,wx.ID_ANY,title) #-- self.grid= wx.grid.Grid(id=wx.ID_ANY,parent=self) self.grid.CreateGrid(numRows=10,numCols=2) self.grid.Fit() self.Fit() #-- self.Show(1) #-- app = wx.PySimpleApp() frame=MainWindow(None,-1,'Grid sizer') app.MainLoop() del app #-- -- http://mail.python.org/mailman/listinfo/python-list
Re: what are you using python language for?
This is my main development tool. I use it for business specific applications (with wx, cherrypy and mysql), mail server administration (in console mode and with cherrypy), and utilities. Regards jm -- http://mail.python.org/mailman/listinfo/python-list
Re: wxPython: Keyboard events and TreeCtrl
> Am I supposed to connect the method to the Frame somehow? Or does it > automatically get called when the user hits Ctrl-I, regardless of the > fact that no other methods call OnKeyDown? I think it must be connected to the treectrl. One line or a combination of : self.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown) self.Bind(wx.EVT_KEY_UP, self.OnKeyUp) self.Bind(wx.EVT_CHAR, self.OnChar) That's coming from the demo (process and events->key events). If it does not work, it'd be helpful if you join your program to a next post, something that we can test without having to write a demo specifically. Regards, jm -- http://mail.python.org/mailman/listinfo/python-list
Re: Boa constructor- is it still alive?
tatamata a écrit : > Does anyone know is Boa constructor project still alive? > I visited Boa web site and it seems that it hasn't been updated for a long > time > I downloaded the version 0.4.4 a couple of months ago, so I guess the project is alive (I have been used the 0.3.1 before). I hope so because I use it and I think there are some nice features (actually, I think it's the best IDE, above all if wx is needed). However, I tried the last year to suggest corrections, but without success. Also, it works better on windows than linux. Regards, jm -- http://mail.python.org/mailman/listinfo/python-list
Re: wxpython: how do i write this without the id parameter?
Hi John John Salerno a écrit : > I was reading in the wxPython wiki that most of the time you don't have > to include the id parameter at all, and you can just use keyword > arguments for other parameters. But I'm having trouble converting this > code into that method (i.e., without the id parameter). I keep getting > errors that involve wrong parameters, or that they are out of order, > etc. So I'm hoping someone can show me how to re-write the constructors > for InputForm and wx.Frame, as well as the __init__ method, so that they > will just deal with parent and title. May I suggest you to use wx.ID_ANY each time you need an id. It's a very clean way to give it even if you don't really care. For instance : wx.StaticBox(self,wx.ID_ANY,"etc...") Regards, jm -- http://mail.python.org/mailman/listinfo/python-list
Re: wxpython: bringing up a dialog box with a button
John Salerno a écrit : > import wx > class InputForm(wx.Frame): > > def __init__(self, parent=None, id=wx.ID_ANY, title=''): > wx.Frame.__init__(self, parent, id, title) > panel = wx.Panel(self) > btnModal = wx.Button(panel, -1, 'Modal') > dialog = wx.Dialog(self, -1, 'Modal Dialog') > self.Bind(wx.EVT_BUTTON, dialog.ShowModal, btnModal) Don't bind directly ShowModal to EVT_BUTTON > Traceback (most recent call last): > File "C:\Python24\Lib\site-packages\wx-2.6-msw-ansi\wx\_windows.py", > line 688, in ShowModal > return _windows_.Dialog_ShowModal(*args, **kwargs) > TypeError: Dialog_ShowModal() takes exactly 1 argument (2 given) When your button gives an event, wx send two arguments : the object itself and an event object. So you can't bind directly. What you have to do is to use an intermediate method. Something like: self.dialog = wx.Dialog(self, -1, 'Modal Dialog') self.Bind(wx.EVT_BUTTON, self.OnClick, b) def OnClick(self, event): self.dialog.ShowModal() Regards, jm -- http://mail.python.org/mailman/listinfo/python-list
Re: wxPython, tree Control text cutoff
Kiran a écrit : > Hello all, > I am using a tree to display stuff, and it is constantly updated, but > what I have noticed is in the lowest level, there is clearly noticable > cutoff of the text I place there. The cutoff is existent even if I do > not update the text inside the tree constantly. It seems that the text > is halfway below where it should line up. I tried placing an image to > see if that would correct it, but it does not. The image is perfectly > lined up, but the text is still misaligned. > > Any known issues of this and how to fix it? By the way, it happens in > both Linux and Windows. Hi Kiran, It works fine if you change : x = self.tree.AppendItem(self.connections[i][j][0], "") to x = self.tree.AppendItem(self.connections[i][j][0], " ") I let you imagine the explanation... Regards, jm Just a hint : it'd be helpfull to solve such a bug if you make your program more simple. To find out the solution, I reduced your program to what's following, and the light came : import wx import wx.gizmos as gizmos class AlarmsWindow(wx.MDIChildFrame): def __init__(self, parent, title, size, pos): wx.MDIChildFrame.__init__(self, parent, -1, title, size = size, pos =pos) self.tree = gizmos.TreeListCtrl(self, -1, style = wx.TR_DEFAULT_STYLE| wx.TR_FULL_ROW_HIGHLIGHT) # create some columns self.tree.AddColumn("Connection") self.tree.AddColumn("Alarm") self.tree.AddColumn("Value") self.tree.SetMainColumn(0) self.root = self.tree.AddRoot("Connections") self.tree.Expand(self.root) self.tree.GetMainWindow().Bind(wx.EVT_RIGHT_UP, self.OnRightUp) self.Show() child = self.tree.AppendItem(self.root, 'name') self.tree.SetItemText(child, 'name') child2= self.tree.AppendItem(child,'name2') ##x = self.tree.AppendItem(child2, "") x = self.tree.AppendItem(child2, "XXX") self.tree.SetItemText(x, 'alarm', 1) self.tree.SetItemText(x, 'value', 2) def OnRightUp(self, evt): pass class MDIFrame(wx.MDIParentFrame): def __init__(self): wx.MDIParentFrame.__init__(self, None, -1, "MDI Parent", size =(600, 400)) child = AlarmsWindow(self, "Alarm", (400, 300), (0, 0)) if __name__=='__main__': app = wx.PySimpleApp() frame = MDIFrame() frame.Show() app.MainLoop() -- http://mail.python.org/mailman/listinfo/python-list
Re: Newbie wxpython staticbitmap help please
janama a écrit : > Can somewhone add a wx.Timer example to this to make it check > if the file exists every minute or so , instead of clicking the button > to check and update this? Or is there a better way of auto updating my > little gui apps StaticBitmap if a file exists? Why won't you write it yourself using the demo ? It's clear and well documented. Regards, jm -- http://mail.python.org/mailman/listinfo/python-list
Re: Newbie wxpython staticbitmap help please
> Thanks for any help with any of this I have no time at the moment. I'm going to try to give you an answer tomorrow morning (june 16) (if nobody did of course). See you jm -- http://mail.python.org/mailman/listinfo/python-list
Re: Newbie wxpython staticbitmap help please
Hi, janama a écrit : > jean-michel bain-cornu wrote: >> Why won't you write it yourself using the demo ? >> It's clear and well documented. >> Regards, >> jm > > Hi, have been just trying for 5 hours with the timer demo in wx, i just > havnt clicked with how to tie it in together, > > I know (think) i need the following features from the timer demo , > where you can periodically call a function using the wx.timer > > self.Bind(wx.EVT_TIMER, self.OnTest1Timer) > #---(bind to the frame ?) Bind to any method > > self.Bind(wx.EVT_BUTTON, self.OnTest3Start, t3b1) > #---(this binds to a button, how do i bind to my application on load or > startup instead ?) ??? > > def OnTest1Timer(self, evt): > self.log.write("got EVT_TIMER event\n") > #---(dont think i need the logging?) You don't need of course, it's just for demo information. > > def OnTest3Start(self, evt): > self.t3 = NotifyTimer(self.log) > self.t3.Start(1000) > self.log.write("NotifyTimer timer started\n") > self.t3b2.Enable() > > #---(the Start i guess i will work if i remap the button event to an on > load type? event? > > def OnTest3Stop(self, evt): > self.t3.Stop() > self.log.write("NotifyTimer timer stoped\n") > del self.t3 > self.t3b2.Disable() > #---(Guess i wont need to stop the timer, as i want it to trigger the > 'refreshing' of the StaticBitmaps ?) > > # When deriving from wx.Timer you must provide a Notify method > # that will be called when the timer expires. > class NotifyTimer(wx.Timer): > def __init__(self, log): > wx.Timer.__init__(self) > self.log = log > > def Notify(self): > self.log.write("got NotifyTimer event\n") > #---(dont know if i need this if i dont want to use this log feature)? > > > Im sorry if this all seems really amatuerish, i have genuially tried > hard to get my head around it , but i get error after error in boa. Boa is well done for editing, simple objects generation, also for learning, but not for complex operation. It's not a good idea to use it for your present need. > Somewhone couldnt append a timer and perhaps help to refresh the > StaticBitmaps described, with the code, in first post). I will be able > to see and learn greatly from this. > > Maybe some advice on where to find lists of the methods used in > wxpython > For example it took me hours to find methods ? like In the help file, there is an alphabetic classes list, with (quite) all the methods. > > StaticBitmap.SetImage("imageName") > > Is there any good lists of these methods, properties etc for wxpython > controls? See before. This is the best, and also the demo (and also the sources). > > Any good wxpython ide/editors that can "intellisense" them? boa, > komodo, stani's arnt working with "intellisensing" wx for me, (maybe i > cant configure them though) The best is probably boa, because it have got a debugger, with a separate process launched for testing. > > Thanks for any help with any of this > > Regards > All what you have to do is : def __init__(self, parent): self._init_ctrls(parent) self.t1 = wx.Timer(self) self.t1.Start(2000) # 2 seconds self.Bind(wx.EVT_TIMER, self.OnTest1Timer) def OnTest1Timer(self, evt): if os.path.isfile('App1.py'): i = wx.Image('image.jpg',wx.BITMAP_TYPE_JPEG) b1 = wx.BitmapFromImage(i) self.staticBitmap1.SetBitmap(b1) And you can continue to use Boa as usual. Hope you'll enjoy, jm Ps: tested on xp, pretty sure it works also on linux. -- http://mail.python.org/mailman/listinfo/python-list
Re: wxPython GUI designer
[EMAIL PROTECTED] a écrit : > I am newbie learning wxPython. I tried using GUI designer called > wxGlade. When it generated code I couldnt get the same level of > flexibility as writing the code by oneself. > > Any view on what you think about using GUI designer tools. > > Every help is appreciated. > Boa is excellent if you stay at a primary level. It's a visual design tool, and it can help you to learn how to manage wx classes. It works on windows and linux as well. My understanding of wxglade is that you need skills about sizers to be confident with it. So if you know how to use sizers, you don't really need a tool. Regards, jm -- http://mail.python.org/mailman/listinfo/python-list
Re: How to truncate/round-off decimal numbers?
> just a thought: if you *always* work with "floats" with two decimals, > you are in fact working with integers, but you represent them as a > floats - confusing for the internal representation. > > So why not work with int(float * 100) instead? This way you only have > to take care of roundoffs etc when dividing. And why won't you work with decimal module ? -- http://mail.python.org/mailman/listinfo/python-list
Re: wxStyledTextCtrl and sql syntax highlightning
> I have the following: > self.__m_styled_text_ctrl = wxPython.stc.wxStyledTextCtrl( > self, wx.NewId(), > style=wxPython.wx.wxNO_FULL_REPAINT_ON_RESIZE) > self.__m_styled_text_ctrl.SetLexer(wxPython.stc.wxSTC_LEX_SQL) > self.__m_styled_text_ctrl.SetProperty("fold", "1") > self.__m_styled_text_ctrl.SetMargins(0,0) > self.__m_styled_text_ctrl.SetKeyWords(0, SQL_KEYWORDS) Hi Pierre, I'd like to do some tests with your stuff, but I'd appreciate to have a working sample. Would you like to post it ? Regards, jm -- http://mail.python.org/mailman/listinfo/python-list
Re: wxPython and Py2exe crashes in "window" mode but not in "console" mode
Hi Jerry, > I have created an application using wxPython and compiled it using > py2exe. When I put > > setup(console=['myscript.py']) > > in my setup.py file, the resulting application runs just fine. But > when I change it to > > setup(windows=['myscript.py']) > > The application crashes without any indication of what happened. > During this particular point in the application it calls a > gethostbyaddr and gethostbyname and does a spawnl to another > application. When I use Tkinter, this does not happen. I've searched > around Google and the py2exe and wxPython sites and haven't found > anything that seems to relate to this. > > Details: > All are binary distributions for Windows running on Windows XP SP2 > ActivePython 2.4.3 Build 12 > wxPython 2.6.3.3 (ansi) for Python 2.4 > py2exe 0.6.5 I'd like to reproduce your crash, could you post a sample ? -- http://mail.python.org/mailman/listinfo/python-list
Re: module time
Sergey wrote: > There is function > mktime() -- convert local time tuple to seconds since Epoch > in module time. > But how about to convert *GMT time tuple* to seconds since Epoch? > > Is there such function? > > Does mktime(gmtime()) suit your needs ? Regs, jm -- http://mail.python.org/mailman/listinfo/python-list
Re: editor for Python on Linux
> Boa-Constructor is an IDE rather than an editor. Although it focuses > on wxPython, it has a good editor. Yes, some possibilities are pretty good, like for instance the findAll/findInFiles keeping the results in a new tab (I never saw this elsewhere). Another useful is having the debugger launching the application in a separate process, an excellent way to avoid bugs pollution coming into the IDE. rgds jm -- http://mail.python.org/mailman/listinfo/python-list
Re: how to write file with cp1250 encodings?
Hi, Grzegorz Smith wrote: > Hi all. I have got situation: i load data from database(MSSQL) wchich are > encoded cp1250 and I fill template with that data (Cheetah Template), after > all i want to save template to file on disk. I'm using > newfile = open("template.html",w") > newfile.write(str(template)) > newfile.close() > But data encodings are saved wrong, and I try diffrent programs to convert > but all i get was only mess. So is this any way to save data with encodings > cp1250 properly? > Any help will be very appreciated > Gregor I had to do it recently, reading from mysql and pushing data into a browser by cherryPy. I used : try: val= dbString.decode('utf8').encode('iso-8859-1') except UnicodeDecodeError: val= dbString The 'try:' was needed because of some extra-character on top of the 7 bits limit raising an exception. I have no more explanations about that, and I must say it was a pain in the neck to find a solution. I guess in your case, you have to replace iso-8859-1 by something else in the case it's not strictly the same that cp1250. The '4.9.2 Standard Encodings' documentation section give some explanations. Regards, jm -- http://mail.python.org/mailman/listinfo/python-list
Re: [ANN] Update to Python Quick Reference Card (for Python 2.4) (v0.67)
> PC-cillin flagged this as a dangerous web site. An explanation would be fine about *why* the web site is flagged as dangerous... -- http://mail.python.org/mailman/listinfo/python-list
Re: Mysqldb & stderr
Hi, > developing a daemon (using python 2.4 and mysqldb 1.2.1_p2) we notes > that mysqldb class write on stderr some warnings and error > asyncronously (uhmmm it's good written? ;P ). > > Someone knows how stop write on stderr (and stdout) on mysqldb? I use warnings filter : ... import warnings warnings.filterwarnings('ignore') import MySQLdb ... May be it can be helpful to you. Regards, jm -- http://mail.python.org/mailman/listinfo/python-list
Re: Simple HTML template engine?
> Can anyone recommend a simple python template engine for generating > HTML that relies only on the Pyhon Core modules? > > No need for caching, template compilation, etc. > > Speed is not a major issue. > > I just need looping and conditionals. Template inheritance would be a > bonus. I have written my own a couple of years ago. It is very simple (just one script with no dependancies) and doesn't offer conditionals and inheritance. The documentation is here : http://www.jmbc.fr/balloondoc/index.html and you can download at : http://sourceforge.net/project/showfiles.php?group_id=162003 I hope this will be helpful. jm -- http://mail.python.org/mailman/listinfo/python-list
Re: Simple HTML template engine?
> These days there seems to be more coverage of different needs. For > instance, Mako looks like something I might have used if it had been > around back then. > It's probably the same to me. And many times, the simple python templating system %(var)s is good enough... -- http://mail.python.org/mailman/listinfo/python-list
Re: smtplib question
>> 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? > > You will need to get smtplib to authenticate when connecting to the > exchange server.Use the login function and the same username/pw > that you use to login to Outlook. > > server.login(user, password) > > Note: Your exchange administrator may have disabled this function. ( > Your Outlook will almost certainly be using MAPI not SMTP to talk to > the server). > It's very often a pain to talk with Exchange. If Outlook Web Access is enabled, you can use urlib/urllib2 to send your emails exactly like you'd do it by a web browser. It's sometimes easier than using the regular smtplib capabilities. Regards, jm -- http://mail.python.org/mailman/listinfo/python-list
Re: IMAP SEARCH Error
> imaplib.abort: command: SEARCH => unexpected response: '*' > > Can anyone tell me why this happens ? It looks like a server problem. What kind of server are you using ? Exchange, Cyrus ? Did you try with two different Imap servers ? If it is a unix server, did you have a look in /var/log ? Or in windows event log ? -- http://mail.python.org/mailman/listinfo/python-list
Re: My python programs need a GUI, wxPython or PyQt4?
Hi > > Just for info - one of the reasons I stopped using Tkinter a few years ago > was for the lack of print support (preview ...) - is there such an > extension today ? > Same for me, it was a point for what I choosed wx. Nowadays, I'd say users commonly accept to get pdf reports instead of direct printing, so it's not so much important. Regards, jm -- http://mail.python.org/mailman/listinfo/python-list
Re: wxPython StatusBar Help
Hi, > I'm working with wxPython 2.8.1.1. > > Does anybody know how to change the foreground colors in a wx.StatusBar You can get inspiration from the following code, but the problem is you will have also to draw all the status bar stuff, not only the foreground color. I don't know any other way. However, I'm used to 2.6 and I could miss something existing in 2.8 (I think to OnCreateStatusBar which exists and don't work in 2.6 and was supposed to work with the next release ; it could be a clue). Regards, jm import wx class MyStatusBar(wx.StatusBar): def __init__(self,*args,**kargs): wx.StatusBar.__init__(self,*args,**kargs) self.Bind(wx.EVT_PAINT,self.OnPaint) def OnPaint(self,event): dc = wx.PaintDC(self) self.Draw(dc) def Draw(self,dc): dc.BeginDrawing() dc.SetBackground( wx.Brush("White") ) dc.Clear() dc.SetPen(wx.Pen('BLACK')) dc.DrawText(self.GetStatusText(),0,0) dc.EndDrawing() if __name__ == "__main__": app = wx.PySimpleApp() frame= wx.Frame(None,wx.ID_ANY,'test frame') statusBar= MyStatusBar(frame,wx.ID_ANY) statusBar.SetStatusText("status text..") frame.SetStatusBar(statusBar) frame.Show(True) app.MainLoop() -- http://mail.python.org/mailman/listinfo/python-list
Re: DCOP memory leak?
> Now, I have to call DCOP very often and I noticed that every time I > make a DCOP call my program keeps growing in memory size. > > To make sure it was DCOP i wrote the small program below: > > from dcopext import DCOPClient, DCOPApp > > while 0==0: > dcop=DCOPClient() > dcop.attach() > AmarokDcopRes = DCOPApp ("amarok", dcop) > ok, Ms = AmarokDcopRes.player.trackCurrentTimeMs() > print Ms > > If you run this script and monitor it's memory use you'll see that it > keeps growing. It's probably silly, but what's about 'del dcop' as the last line of your loop ? -- http://mail.python.org/mailman/listinfo/python-list
Re: Decimating Excel files
Hi, > We have a data acquisition program that saves its output to Excel's > ..xls format. Unfortunately, the programmer was too stupid to write > files the average user can read. > > I'd like some advice on how to go about: > 1. Reading a large Excel file and chop it into many Excel files (with > only 65535 lines per file) > or > 2. Decimate an Excel file & write... say every other line (user > selectable)... to a new file. > > I'm pretty experienced at reading and writing simple text files, but > this is my first foray into using COM. I would imagine either choice 1 > or 2 is pretty simple once I can get the file open. When I have Excel stuff to do, I use : http://sourceforge.net/projects/pyexcelerator May be it can cover your needs ? From my point of view, COM is something to avoid : no docs, lot of investigations, weak results. Regards jm -- http://mail.python.org/mailman/listinfo/python-list
Re: wxPython: TextCtrl delayed update when using TE_RICH(2)
Hi, > def Execute(self, evt): > print "Start query" > time.sleep(5) > > The "Start query" message should show in the *messages* box when I > press the button. Instead, it shows only after the time.sleep(5) > delay. > > If I don't use the wx.TE_RICH / wx.TE_RICH2 style on *messages*, the > text shows before the time.sleep(5) For this kind of stuff, I'd try to put "self.out.WriteText(string)" in some 'Idle' event, which avoid to fall in focus loops or other objects events management problems not easy to solve. Did you try something like that : def write(self, string): self.outBuffer= string def onIdle(self,event): if self.outBuffer != None: self.out.WriteText(self.outBuffer) self.outBuffer= None -- http://mail.python.org/mailman/listinfo/python-list
Re: wxPython: TextCtrl delayed update when using TE_RICH(2)
>> For this kind of stuff, I'd try to put "self.out.WriteText(string)" in >> some 'Idle' event, which avoid to fall in focus loops or other objects >> events management problems not easy to solve. >> > > This doesn't have anything to do with focus loops or otherwise, it's > because the OP isn't familiar with event based programming. > > You're performing a long-running task which is preventing the event > loop from processing, so your text isn't updating and your application > is unresponsive. You need to rewrite your task - either do everything > asynchronously, or use a threaded approach. If you use the thread > approach, be sure to not call the updates directly, you can use the > wx.CallAfter mechanism to call gui functions in a threadsafe manner. So it is an event management problem. The event loop is not yet finished when the program want to display something, potentially initiating a new event loop. If you don't want to bother with threads, the idle event approach is not so bad. Put something to display in a buffer, and display it only one time the gui have nothing else to do. I use it every time I can, and it's very safe and easy to do. Furthermore, you can still step into the program with a debugger, which can be tricky if the program uses threads (I'd say impossible, but I didn't try in fact). Regards jm -- http://mail.python.org/mailman/listinfo/python-list
Re: wxPython: TextCtrl delayed update when using TE_RICH(2)
> > This is almost totally wrong. There is no "new event loop" involved. > The OP is running a long task in the main thread, which is blocking > the event loop. When the event loop is blocked, the application will > not update and cannot be interacted with. It's that simple. The event > loop in a gui application doesn't "finish" until the application > exits. I appreciate the fact that it is not *completely* wrong... Try to get out of your point of view, maybe you'll find something interesting. Maybe the 'true' part of mine. Regards jm -- http://mail.python.org/mailman/listinfo/python-list
Re: Best Free and Open Source Python IDE
> On the OSS side, SPE is very good too - more of an IDE than Komodo > Edit. DrPython is worth a look as is the similar Ulipad. Also have a > look at Boa. > Boa is excellent if you plan to use wxwidgets. Regards jm -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Debugger / IDE ??
[EMAIL PROTECTED] wrote: > I've always been happy with the debugger in PythonWin. You can even > use: > > from pywin.debugger import set_trace;set_trace() > > to bring up the debugger directly from a script that wasn't originally > run in the ide. I use that one also. There is also Boa (http://boa-constructor.sourceforge.net/), available both in Linux and Windows, and with the avantage of having a separate process for the debugging unit, which is great when you have to explore some unsane scripts. Regards jm -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Debugger / IDE ??
bruno at modulix wrote: > FWIW, I've almost never used a debugger with Python. It's pourtant very simpa from time to time ! -- http://mail.python.org/mailman/listinfo/python-list
Re: unicode error
[EMAIL PROTECTED] wrote: > I have this python code: > print >> htmlFile, " style=\"width: 200px; height:18px;\">"; > > > But that caues this error, and I can't figure it out why. Any help is > appreicate > File "./run.py", line 193, in ? > print >> htmlFile, " style=\"width: 200px; height:18px;\">"; > UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 9: > ordinal not in range(128) > > Thanks. > Hi, I tried and it worked (wrote into the file:). Can you try to isolate exactly what part of the code is wrong ? jm Here is the complete code: htmlfile=file('jmbc.txt','w') print >> htmlfile, ""; htmlfile.close() -- http://mail.python.org/mailman/listinfo/python-list