tk the python way
Title: tk the python way I'm strugling a little with TK, and the docs on the web aren't helping much. I've already rewritten about twelve times a basic class that was supposed to simply draw a window. It's not even close the final draft, but i tought "well, let's start with something easy that can be done in less than an hour"... silly me. But keep reading, it's not just to vent my frustations :) The main issue here is: How to use TK eficiently. I'm already planing another post about the pack/grid/place-power-trio but for now: what's the better, most scalable and less cumbersome way to use Tk? 1. Windows a) hide Tkroot in __main__ and call the class, whom willcreate it's own windows. b) let __main__ pass the root window and make the class always require a parent. c) what's the "industry standandard" for a single or dual window small app? (no, it's not java, wrong topic) 2. Buttons What's the nicer way to pass arguments directly in a button action? I don't know if this one is me just being dumb. but `Button(..., command=doit(1) )` doesn't work for me and i haven't seen it in any doc... I came to the point of writing: btnHd = Button(..., command=self.__fileBrowseH) btnCd = Button(..., command=self.__fileBrowseC) btnFd = Button(..., command=self.__fileBrowseF) and self.__fileBrowse/[CHF]/() being just a wraper for self.__fileBrowse('/[chf]/') ...And don't miss on this same channel: my indignation with Tk's positioning systems :P Thanks! Gabriel -- http://mail.python.org/mailman/listinfo/python-list
RE: How to make executable file ?
Title: RE: How to make executable file ? > Also, you can try with py2exe. It's very easy. > Catalin. > > You may want to try cx_freeze. I brief experience with both. may be helpful 1. I did a little program on python/TK. Some 100 lines or less 2. executed cx_freeze 3. executed py2exe In the end, i had a dir with the name of the script: 03/12/04 18:08 . 03/12/04 18:08 .. 03/12/04 18:07 28.672 bugger.12.exe 25/05/04 21:19 45.117 datetime.pyd 03/12/04 18:07 563.528 library.zip 09/11/04 15:41 964 palavras.txt (this is data, i put here) 25/05/04 21:17 974.909 python23.dll 03/12/04 18:07 tcl 31/03/04 21:34 569.344 tcl84.dll 31/03/04 21:41 1.011.200 tk84.dll 25/05/04 21:18 16.384 w9xpopen.exe 25/05/04 21:18 57.401 _sre.pyd 25/05/04 21:19 36.925 _tkinter.pyd 10 File(s) 3.304.444 bytes 3 Dir(s) 2.143.559.680 bytes free Despite the fact that it got extremely big (but i wasn't expecting less when i started) it got pretty clumsy for what i had in mind. I was hoping for something like a 10Mb-single-exe-file kinda of result :) I belive cx_freeze didn't did much because i had no small includes. just the huge ones like Tk. Gabriel -- http://mail.python.org/mailman/listinfo/python-list
RE: Point of Sale
Title: RE: Point of Sale Hi, i'm curently doing a POS. But mine is a small scale and stand alone. Are you planing on developing in house and then opening? develop at open or simple use open source tools and keep it closed? I'm going to post my progress at source forge next week when i finish proof reading the design docs. i'm curently focused in the HCI layer (primarily using only plain tk) and haven't gave much tought to the 'external' stuff, like integrating wire money cards and such Gabriel -Original Message- From: Andreas Pauley [mailto:[EMAIL PROTECTED]] Sent: quinta-feira, 27 de janeiro de 2005 11:08 To: python-list@python.org Subject: Point of Sale Hi, My company has given me a rather cool project: I have to provide them with an open-source python-based point-of-sale / cash register system that can integrate with their existing ERP backend. The project will include development to ensure that the features they require are included in the open-source POS system. Can you recommend anything that I can use? Regards, Andreas -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
leo editor
Title: leo editor A co-worker was trying to convince me that Leo[1] is the better editor of all since it outline the code and let you easily document algoritms and logic. He was writting php code with it. I use jEdit or vi to write my python and my php Then after a day of debates I ended up convincing him that abstracting every algorith and complex logic into a separate class and using the doc inside the class the python way was exactly the same thing that Leo does, if not better hence you don't need an IDE for that. But then, I realised that maybe it's just that we don't get it yet. So, the question i drop here is if anyone uses or is forced to use Leo for bigger projects, does it help or get in the way? Does the project management capabilities pay off the tangling/untangling hassle? Does it make it easier to work if the group is bigger? Thanks! Gabriel [1] http://webpages.charter.net/edreamleo/front.html -- http://mail.python.org/mailman/listinfo/python-list
RE: Tkinter vs wxPython
Title: RE: Tkinter vs wxPython *warning* My very own opinions ahead. no flame intended. > Try them both out for an hour or two, and go with whichever > one "feels right". You very likely won't be making a mistake. i did that for java+swing, python+tk, python+gtk, python+wxWindow and python+glade I limited myself in one hour, and at a maximum 2 hours if the docs aren't perfect (i had zero experience at the time with all of them) The program code was already written, it only needed the gui. Java took me 3 hours to hook all the ungly hacks for dealing with threads in the AWT... but i will not elaborate on it because it would be kicking a dead horse. now for something completely diferent: python :) tk: the docs where superberb! done everything in 25min! then spent an hour polishing and adding status bars for everything :) gtk: had to use the C api docs. wasted some time figuring it out, gave up after one hour and a half and ended up with a window layout that didn't maximezed well. wx: Almost two hours. Once you get used to the docs and get the knowledge to read some examples all is fine. i liked the result. and liked the api but disliked the sea of constants necessary (i hated it in gtk also) glade: i gave up after 2hours of reading licenses and dealing with broken libs. Also, i can't run in beOS or tweak widgets. bah! rather go back to visual basic ;) Now going back on topic: A think that neighter Tk nor wxWindow is a good choice for python. They both suck much of it when it came to abstraction. They're still better than glade or gtk. But could improve a lot. wxWindow has simple an ugly API, and Tk has a huge sin in the syntax to pass actions to the buttons. But after all, i'm using exclusively TK for now. But things might change as i'm in a project with a huge need of non-ortodox input, so i may be going back to read about wxWindow event handlers or even pygame. peace, Gabriel -- http://mail.python.org/mailman/listinfo/python-list
os.walk bug?
Title: os.walk bug? Hi I'm new to the list. i found a bad behaviour of os.walk that i can reproduce 100% but didn't find an answer to why it does that I have the folowing tree: t:\dir1 t:\dir1\2000 t:\dir1\2001 t:\dir1\content t:\dir2 t:\dir2\2000 t:\dir2\2001 t:\dir2\2002 t:\dir2\2003 t:\dir2\2004 t:\dir2\content t:\dir2\templates what i wanted was to loop in each dir and skip the years (i don't want to touch archive). So i wrote: for root, dirs, files in os.walk('t:\'): # -- do stuff print "working on", root # -- stuff done print 'DEBUG: dirs =', dirs for d in dirs: # -- remove archive if d[:2] == '20': print "--- removing:", d dirs.remove(d) And when i run it i got the following output working on t:\ working on t:\dir1 DEBUG: dirs = ['2000', '2001', 'content'] --- removing 2000 --- removing 2001 working on t:\dir1\content working on t:\dir2 DEBUG: dirs = ['2000', '2001', '2003', '2002', '2004', 'content'] <- why is this in this sequence? --- removing 2000 --- removing 2003 --- removing 2004 working on t:\dir2\2001 . . . I am nuts? running as os.walk('t:\dir2') make it ignore the same dirs. i'm using python 2.3 on windows 2000. The t: drive is a webdav mount. Thanks, Gabriel -- http://mail.python.org/mailman/listinfo/python-list
RE: Best GUI for small-scale accounting app?
Title: RE: Best GUI for small-scale accounting app? ( sorry about top posting) 1. Ever avoid web based. unless you have to do it webbased. I've been doing web based apps for 5 years now. it simple don't pay off! usability within a browser sucks, unless you can spend time re-writting the whell on _javascript_. then you have to deal with things like the back button going to a POST page, user cancel actions... it simple don't pay off unless you really has to access it from diferent machines. But ok, i think this will became a flame war if i go on... 2. from my ridiculously short experience with python-client-sided: gtk is way too clumsy. wxWindows has a weird way of handling events and such. tk is very simple. Qt i didn't even considered because of license and mainly because it's less cross plataform then java ;-) So. i did all my programs in tk. But i subclassed a lot so in the future it would be easy to just snap in another gui toolkit. -Original Message- From: Paul Rubin [mailto:"http://phr.cx"@NOSPAM.invalid] Sent: segunda-feira, 20 de dezembro de 2004 10:43 To: [EMAIL PROTECTED] Subject: Re: Best GUI for small-scale accounting app? Bulba! <[EMAIL PROTECTED]> writes: > I'll soon start development of a specialized small app and need > to choose GUI for it. > > I have narrowed the choice to wxPython/PythonCard and QT/PyQT What does the app need to do? I'd try to make it web based unless there's a good reason not to. That's even if it just runs on the user's desktop; run the http listener on the localhost and let the user connect to it with a browser. However, between those two you mention, wxPython seems easier to use and runs on more platforms. On the other hand, it may be less well maintained than QT. For example, its current installation script seems to assume an older version of GTK is installed, and it fails with newer GTK versions. -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Jython performance
Title: Jython performance On the "Best GUI for small-scale accounting app?" tread some people mentioned jython. I went to read about it, but i was wondering if anyone has any real project done with it and can give real world comments about performance. Thanks, Gabriel -- http://mail.python.org/mailman/listinfo/python-list
RE: Best GUI for small-scale accounting app?
Title: RE: Best GUI for small-scale accounting app? > I went w/wxPython for a second app because of its printing capabilities > and the large number of controls that come with it. Otherwise I would > use pyFltk for small apps. does FLK has any good positioning model now? Last time i checked i could only put something in pixel(sic) x=10, y=10, width=100, height=100. It's awfull because you have to write window resize code (argh) and the widgets doesn't repect the font size if said user is using a resolution like 1900x1600 with DPI of almost 300 (my case hehe). Since your testing enviroment probably was 800x600 with a DPI of no more then 100 you'r big screen user will have fonts 1/3 of the desired size. -- http://mail.python.org/mailman/listinfo/python-list
RE: extract news article from web
Title: RE: extract news article from web Excel in later offices has the "web query" feature. (sorry about top posting) -Original Message- From: Steve Holden [mailto:[EMAIL PROTECTED]] Sent: quinta-feira, 23 de dezembro de 2004 12:59 To: python-list@python.org Subject: Re: extract news article from web Zhang Le wrote: > Thanks for the hint. The xml-rpc service is great, but I want some > general techniques to parse news information in the usual html pages. > > Currently I'm looking at a script-based approach found at: > http://www.namo.com/products/handstory/manual/hsceditor/ > User can write some simple template to extract certain fields from a > web page. Unfortunately, it is not open source, so I can not look > inside the blackbox.:-( > > Zhang Le > That's a very large topic, and not one that I could claim to be expert on, so let's hope that others will pitch in with their favorite techniques. Otherwise it's down to providing individual parsers for each service you want to scan, and maintaining the parsers as each group of designers modifies their pages. You might want to look at BeutifulSoup, which is a module for extracting stuff from (possibly) irregularly-formed HTML. regards Steve -- Steve Holden http://www.holdenweb.com/ Python Web Programming http://pydish.holdenweb.com/ Holden Web LLC +1 703 861 4237 +1 800 494 3119 -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
hidding the "console" window + system global shortcut keys
Title: hidding the "console" window + system global shortcut keys Hi, it's a broad topic because they all poped in my head at the same time while writting the alpha version of a desktop-helper app. The app must be the less obstrusive possible. some history: It's mainly for win32. I started writting this to compensate the lack of posix tools and pipes on win32. in *NIX i could use wc, grep, sort, et al to deal with files(?). In windows, i mainly depend on my text editor. I strugle with no 'grep' or no 'cut' or no easy way to pass data between programs other then copy paste or saving the file. The actual method of saving, opening a w32 port of bash, and then doing the usual *NIX way is too intrusive in windows because you have to leave you "ambient", do things, go back to your previous "ambient". So, the program was to sit in the taskbar or in the systray. and by some mouse clicks or global key combinations transform the selected text or the clipboard content with a easy-to-input posix like syntax mimic by python functions. I haven't even scrateched the surface for all that. but for that pre-alpha i *really* want to mainly do those things: 1. Give a painfull death to the "console window" i will need console output only in debuging 2. Set global key biddings. #1 is really superfulous, i know, but #2 is really driving me nuts. the key bidings would be idealy in a multiplataform way, since i use* W32, Irix, BeOS and OSX. in that order :) Thanks for any hints Gabriel * I also use Plan9 but it has then times more 'pipes' suport in the GUI then any *NIX has in CLI hehe and yep, no linux/bsdish desktop here. the CLI enviroment fulfill perfectly my needs. X only gets in the way -- http://mail.python.org/mailman/listinfo/python-list
RE: Best GUI for small-scale accounting app?
Title: RE: Best GUI for small-scale accounting app? > From: Paul Rubin [mailto:"http://phr.cx"@NOSPAM.invalid] > > Dave Cook <[EMAIL PROTECTED]> writes: > > > You might not care. > > > > And in that case Tk is much simpler than just about anything else, unless > > looks are really important. > > I've used tk and I don't think it's simpler than html. I've been doing webapps for 5 years now. *THE* thing that make it's worthless: after you've sent the data, your program loose all ability to deal with user interface. After you send the form to the user, you loose ALL habilities of python, php, mysql, etc... and are solely on the _javascript_ fields. And that _javascript_ will have only the provided data of that session to get things done, so you can't send all the DB to the client :) Nowadays that you can use and trust user requests, as widely advertised by "google sugest", you can overcome one of the pitfalls of html: the responsiveness to user input. Now, the second one: responsiveness to server envents, still has to rely on non-standard xml streams or third party hacks using macromedia crap. take for example gMail. A program like that had at least 60% of it's development made on the _javascript_ side. And it still doens't solve the second issue. So, as i said in my 1st post in this thread: both have their problems, but it's all about what you need to get done. so, get used to both. If you can use one-shot pages, go for html, since all the toolkit is easily available in the browser, the network hassle is also done by the browser, the input history... also done by the browser! yada yada yada Now, if you need interactivity, say a game for example, then run away from html like hell. Gabriel -- http://mail.python.org/mailman/listinfo/python-list
RE: Best GUI for small-scale accounting app?
Title: RE: Best GUI for small-scale accounting app? From: Paul Rubin [mailto:"http://phr.cx"@NOSPAM.invalid] > This still seems way too complicated. Why execute a bunch of separate > statements when what you're trying to set up is a single structure? IMHO, i think that the code to create elements is the less important one. I put myself to learn python toolkits in one day. I picked up gtk, tk and wxWindow. I learned how to create the elements in seconds. all have a fairly good documentation on that. But when it cames down to position stuff... that was hell. Or you have a easy way to position things, but are limited for text direction (important in multi-locale programs), limited in font size (important for multiple resolutions) and mainly limited in window resizing (you have to write code for resize). Or you have to add two hundred panes and invisible elements to have flexibility on the above issues. What i'm doing now, is to learn very all Tk, and make a xml scheme for UI. Easy to visualize. I'm just struggling with the best way to deal with runtime modifications of the GUI... apreciate any comments (this will be up on sourceforce soon) Gabriel -- http://mail.python.org/mailman/listinfo/python-list
RE: Best GUI for small-scale accounting app?
Title: RE: Best GUI for small-scale accounting app? > But even then, if DaBo ever becomes as easy to use as Delphi/VB for this > type of applications, while remaining cross-platform, that might easily > double the number of Python developers. ;-) VB/delphi are ridiculous. dont' aim to that direction. the ONLY reason both are "sucessful" is that they're widely deployed. There's thousands of college professors that only got their positions because they have M$certs or are in the institution long enough to know people who can keep their positions and never minded learning something else then pascal and cobol. Then, they show VB/delphi to the newcomers, how get a pirated copy and start wasting time over it. -- http://mail.python.org/mailman/listinfo/python-list
RE: Best GUI for small-scale accounting app?
Title: RE: Best GUI for small-scale accounting app? > > - speed where it matters (ie. no 20s load time) > > Load what? The app, or the data? Users don't care how long the app > takes to start up, since they usually run it all day long. Data > response is a whole 'nother matter, and Dabo is extremely fast in that > regard. After all, a data set is nothing more than lists of lists, and > Python is wicked fast with list handling. as a jEdit, mozilla, and bloated games user i can assure you that you're right at some point, but as a openoffice hater, you can see it's not the lawn even with one single user. So, to be more direct: If you create one app that opens one window with one button in wxWindow and exit (exit, so that 'time' can canculate it for you), and then the same thing in Dabo, what's the time diference? Thanks, Gabriel -- http://mail.python.org/mailman/listinfo/python-list
RE: A scoping question
Title: RE: A scoping question > myBaseClass.AddChild(file2.NextClass()) > [snip] > class NextClass: > def __init__(self): > for eachChild in myBaseClass.MyChilds: # <- ERROR > ... I never assumes globals in my classes. always pass them as parameters. it's safer and better to understand later. Also, makes it easier to reuse the code later on. myBaseClass.AddChild( file2.NextClass( myBaseClass ) ) Gabriel -- http://mail.python.org/mailman/listinfo/python-list
vga output
Title: vga output i'm writting an app to display images without X... i'm scared just to think about writting it in C... The hardware won't run X. and the CPU is very humble, around 20Mhz (and it must have fade outs). it run a minimalisc OpenBSD kernel. Anyone already did something similar and/or have any recomendations? Thanks, Gabriel -- http://mail.python.org/mailman/listinfo/python-list
RE: vga output
Title: RE: vga output > svgalib should do what you want; I don't know if there are python > bindings for it, but they should be pretty easy to make if not. I was hopping for a already binded solution :) But i think i can try to do the bindings for that, can someone point me to some good written doc? i've had no luck with google or the python.org :-/ Thanks -- http://mail.python.org/mailman/listinfo/python-list