From eric at intellovations.com Mon Aug 2 19:56:47 2010 From: eric at intellovations.com (Eric Floehr) Date: Mon, 2 Aug 2010 13:56:47 -0400 Subject: [CentralOH] PyOhio Official Sprints In-Reply-To: <4C5700C7.5040503@osu.edu> References: <4C5700C7.5040503@osu.edu> Message-ID: ---------- Forwarded message ---------- From: Michael S. Yanovich PyOhio sprints are still going on even after PyOhio is over. There are coding sprints at 9:00AM and 7:00PM today (2-Aug-10), and 9:00AM and 7:00PM tomorrow (3-Aug-10). These were advertised but no as heavily as the conference itself. So if you missed your chance to attend the conference but still want to meet the people that were at the conference or want to work on some code feel free to stop by! Also if you missed the conference but would like to see what happened keep checking back on http://pyohio.org/ they will be uploading videos of each talk sometime within the next few weeks. For more information about the sprints as a whole check out: http://www.pyohio.org/Sprints2010 (for example, what's a sprint, FAQ) Also if you have any questions feel free to contact someone through IRC at irc.freenode.net in room #pyohio Hope to see you there! Summary: 9:00AM - 7:00PM - 2-Aug-10 - Sprints! Creative Arts Room in The Ohio Union located at 1739 N. High St. 7:00PM - 11:59PM - 2-Aug-10 - Sprints! Subway located at 1952 N. High St. (near 17th ave) 12:00AM - ??? - 3-Aug-10 - Sprints! Buckeye Donuts located at 1998 N. High St. 9:00AM - 7:00PM - 3-Aug-10 - Sprints! Creative Arts Room in The Ohio Union located at 1739 N. High St. 7:00PM - 11:59PM - 3-Aug-10 - Sprints! Subway located at 1952 N. High St. (near 17th ave) 12:00AM - ??? - 4-Aug-10 - Sprints! Buckeye Donuts located at 1998 N. High St. -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 5600 bytes Desc: not available URL: From mark at microenh.com Wed Aug 4 01:45:13 2010 From: mark at microenh.com (Mark Erbaugh) Date: Tue, 3 Aug 2010 19:45:13 -0400 Subject: [CentralOH] SingleInstance Recipe (Windows) Message-ID: <49437B68-6229-46A9-9913-13B308CF8E5D@microenh.com> I've been looking into ways to make sure that only one instance of a Python application runs. This is for Windows. ActiveState Recipe #474070 is one way: from win32event import CreateMutex from win32api import CloseHandle, GetLastError from winerror import ERROR_ALREADY_EXISTS class singleinstance: """ Limits application to single instance """ def __init__(self): self.mutexname = "testmutex_{D0E858DF-985E-4907-B7FB-8D732C3FC3B9}" self.mutex = CreateMutex(None, False, self.mutexname) self.lasterror = GetLastError() def aleradyrunning(self): return (self.lasterror == ERROR_ALREADY_EXISTS) def __del__(self): if self.mutex: CloseHandle(self.mutex) #---------------------------------------------# # sample usage: # from singleinstance import singleinstance from sys import exit # do this at beginnig of your application myapp = singleinstance() # check is another instance of same program running if myapp.aleradyrunning(): print "Another instance of this program is already running" exit(0) # not running, safe to continue... print "No another instance is running, can continue here" However (apart from the typos), playing with it, I found that the only reason it worked was that the application instances involved were terminating and Windows was cleaning things up. When I was playing with it in a couple of interactive python windows, I found that it did not work as expected. I looked into the cause and came up with an alternative that does work. import win32event import win32api class SingleInstance: """ Limits application to single instance sample usage: ========== import singleinstance import sys myApp = singleinstance.SingleInstance('name') if myApp.fail: print "Another instance of this program is already running sys.exit(0) ========== Make sure myApp is a global and exists as long as the application is running. The key is that myApp hangs on to a copy of the mutex (self.mutex) only if the call to CreateMutex is successful. When myApp goes out of scope, self.mutex is released and another instance of the application can run. """ def __init__(self, name): """ name - name of mutex """ mutex = win32event.CreateMutex(None, False, name) self.fail = win32api.GetLastError() != 0 if not self.fail: self.mutex = mutex Comments are welcome. Mark -------------- next part -------------- An HTML attachment was scrubbed... URL: From miles.groman at gmail.com Wed Aug 4 03:04:22 2010 From: miles.groman at gmail.com (m g) Date: Tue, 3 Aug 2010 21:04:22 -0400 Subject: [CentralOH] SingleInstance Recipe (Windows) In-Reply-To: <49437B68-6229-46A9-9913-13B308CF8E5D@microenh.com> References: <49437B68-6229-46A9-9913-13B308CF8E5D@microenh.com> Message-ID: For a simple solution on a UNIX box, I would write the process id to, or at least touch, /var/run/myapp.pid. If the pid file already exists, I know that the application is already running. Of course, the possibility exists that something happened to the application, and it was not able to remove the pid file.... just delete the pid file if you are sure its not running: ps ax | grep $(cat /var/run/myapp.pid) From mark at microenh.com Wed Aug 4 03:34:31 2010 From: mark at microenh.com (Mark Erbaugh) Date: Tue, 3 Aug 2010 21:34:31 -0400 Subject: [CentralOH] SingleInstance Recipe (Windows) In-Reply-To: References: <49437B68-6229-46A9-9913-13B308CF8E5D@microenh.com> Message-ID: <3E667B18-9D79-47F6-9F4D-C7F6D02C85FB@microenh.com> On Aug 3, 2010, at 9:04 PM, m g wrote: > For a simple solution on a UNIX box, I would write the process id to, > or at least touch, /var/run/myapp.pid. If the pid file already > exists, I know that the application is already running. Of course, > the possibility exists that something happened to the application, and > it was not able to remove the pid file.... just delete the pid file if > you are sure its not running: ps ax | grep $(cat /var/run/myapp.pid) Thanks. I found a couple of solutions for Unix. One was similar to what you suggest. In fact, I found a recipe at ActiveState that if if found a .pid file tested to see if the process was running. The other users fcntl.flock to lock this file and fail if a lock couldn't be obtained. Here's some code I modeled after that: class SingleInstance: """ Limits application to single instance (Linux / Mac) sample usage: ========== import si_unix import sys myApp = si_unix.SingleInstance('name') if myApp.fail: print "Another instance of this program is already running sys.exit(0) ========== Make sure myApp is a global and exists as long as the application is running. The key is that myApp hangs on to a copy of the file handle (self.fp) only if the call to CreateMutex is successful. When myApp goes out of scope, self.fp is released and another instance of the application can run. """ def __init__(self, name): pid_file = os.path.join(os.path.sep, 'var', 'run', '%s.pid' % name) fp = open(pid_file, 'w') try: fcntl.lockf(fp, fcntl.LOCK_EX | fcntl.LOCK_NB) self.fail = False self.fp = fp except IOError: self.fail = True fp.close() -------------- next part -------------- An HTML attachment was scrubbed... URL: From mark at microenh.com Wed Aug 4 03:43:46 2010 From: mark at microenh.com (Mark Erbaugh) Date: Tue, 3 Aug 2010 21:43:46 -0400 Subject: [CentralOH] SingleInstance Recipe (Windows) In-Reply-To: References: <49437B68-6229-46A9-9913-13B308CF8E5D@microenh.com> Message-ID: <8D980D4E-55E8-4AFF-9A10-CF8F3AA29923@microenh.com> On Aug 3, 2010, at 9:04 PM, m g wrote: > For a simple solution on a UNIX box, I would write the process id to, > or at least touch, /var/run/myapp.pid. If the pid file already > exists, I know that the application is already running. Of course, > the possibility exists that something happened to the application, and > it was not able to remove the pid file.... just delete the pid file if > you are sure its not running: ps ax | grep $(cat /var/run/myapp.pid) I ran into a problem using /var/run/.pid. On both my Mac and Ubuntu, the user doesn't have write access to this directory. Mark From miles.groman at gmail.com Wed Aug 4 15:24:07 2010 From: miles.groman at gmail.com (m g) Date: Wed, 4 Aug 2010 09:24:07 -0400 Subject: [CentralOH] SingleInstance Recipe (Windows) In-Reply-To: <8D980D4E-55E8-4AFF-9A10-CF8F3AA29923@microenh.com> References: <49437B68-6229-46A9-9913-13B308CF8E5D@microenh.com> <8D980D4E-55E8-4AFF-9A10-CF8F3AA29923@microenh.com> Message-ID: You can create a folder in /var/run named 'myapp', owned by the user of your program, and then write the pid file to /var/run/myapp/myapp.pid (I assume it is a daemon of some sort). From wam at cisco.com Wed Aug 4 16:06:26 2010 From: wam at cisco.com (William McVey) Date: Wed, 04 Aug 2010 10:06:26 -0400 Subject: [CentralOH] SingleInstance Recipe (Windows) In-Reply-To: References: <49437B68-6229-46A9-9913-13B308CF8E5D@microenh.com> Message-ID: <1280930786.6417.548.camel@goldfinger> On Tue, 2010-08-03 at 21:04 -0400, m g wrote: > For a simple solution on a UNIX box, I would write the process id to, > or at least touch, /var/run/myapp.pid. If the pid file already > exists, I know that the application is already running. If you (or anyone else) decides to use a pid file (or any other constant filename) as a locking/concurrency mechanism, please (oh please) remember to open it like: try: fd = os.open(PIDFILE, os.O_EXCL|os.CREAT|os.O_TRUNC|os.O_WRONLY, 0644) os.write(fd, "%s\n" % os.getpid()) os.close(fd) except OSError, msg: sys.exit("Pidfile already exists. Exiting early: %s" % msg) Although using os.open and os.write is a pain, it's import that the check for the existence of the file and the creation of the file (if it doesn't already exist) be an atomic operation. Something as simple as: if os.path.exists(pidfilename): sys.exit("Pidfile exists") pidfile = open(pidfilename, "w") opens your script up to a race condition where between the execution of the exists() and the open() call the contents of the file/directory may have changed on you. If you're lucky, this could mean that you just have two simultaneously running copies of your program running. If you're unlucky and this was a malicious race exploitation, your pidfile may have been substituted for a symlink pointing to some file that some attacker wanted to be clobbered. I've seen essentially this same bug exploited with vi, at, cron, mail, elm, and many other tools over the years. It's important to not ignore the lessons of the past, even if it is inconvenient. -- William From aezekielian at gmail.com Wed Aug 4 17:03:53 2010 From: aezekielian at gmail.com (Armen Ezekielian) Date: Wed, 4 Aug 2010 11:03:53 -0400 Subject: [CentralOH] Post-processing of output files/creating animation Message-ID: I have a C program which outputs a six-column by N-row data file for each time step of a simulation. The six columns contain floats representing the coordinates and velocity components for N particles. N is generally on the order of a few hundred and there are at least 1000 of these files. x y z v_x v_y v_z N of these lines --> 1.0 1.3 1.1 2.6 1.9 3.8 And as I said there is one of these files for each time step. I was hoping to use python to process these data files and create a visualization using the visual.sphere() function in VPython. I want to render a sphere at every x, y, z point and color the spheres according to a colormap based on the magnitude of the velocity (red = fast, blue = slow). This would be done for each time step file and then loop through them to create an animation. Unfortunately I have limited python experience and little time to accomplish this. If anyone has any tips/suggestions on how to do the file I/O I would be extremely grateful. I am researching the problem myself but the majority of my time is being spent helping the students debug/run their C programs which produce the output files above. Thank you!!! --Armen From yyc at seety.org Wed Aug 4 17:24:25 2010 From: yyc at seety.org (Yung-Yu Chen) Date: Wed, 4 Aug 2010 11:24:25 -0400 Subject: [CentralOH] Post-processing of output files/creating animation In-Reply-To: References: Message-ID: On Wed, Aug 4, 2010 at 11:03, Armen Ezekielian wrote: > I have a C program which outputs a six-column by N-row > data file for each time step of a simulation. The six columns > contain floats representing the coordinates and velocity > components for N particles. N is generally on the order of a > few hundred and there are at least 1000 of these files. > > x y z v_x v_y v_z > N of these lines --> 1.0 1.3 1.1 2.6 1.9 3.8 > > And as I said there is one of these files for each time step. > > I was hoping to use python to process these data files and > create a visualization using the visual.sphere() function > in VPython. I want to render a sphere at every x, y, z > point and color the spheres according to a colormap > based on the magnitude of the velocity (red = fast, > blue = slow). This would be done for each time step file > and then loop through them to create an animation. > > The following code should be able to parse your data file into numpy.ndarray . You need numpy installed. I am not familiar with vpython, but I guess the data should be fairly easy to be processed once you have the data become a numpy.ndarray. #!/usr/bin/env python def main(): import sys from numpy import array if len(sys.argv) < 2: return lines = open(sys.argv[1]).readlines()[1:] arr = array( [[float(val) for val in line.split()] for line in lines], dtype='float64', ) print arr if __name__ == '__main__': main() > Unfortunately I have limited python experience and little > time to accomplish this. If anyone has any tips/suggestions > on how to do the file I/O I would be extremely grateful. I am > researching the problem myself but the majority of my time is > being spent helping the students debug/run their C programs > which produce the output files above. Thank you!!! > > --Armen > _______________________________________________ > CentralOH mailing list > CentralOH at python.org > http://mail.python.org/mailman/listinfo/centraloh > -- Yung-Yu Chen PhD candidate at The Ohio State University Columbus, Ohio +1 (614) 292 6745 -------------- next part -------------- An HTML attachment was scrubbed... URL: From asb.bush at gmail.com Thu Aug 5 03:54:56 2010 From: asb.bush at gmail.com (Aaron Bush) Date: Wed, 4 Aug 2010 21:54:56 -0400 Subject: [CentralOH] Post-processing of output files/creating animation In-Reply-To: References: Message-ID: While not a solution in Python I would suggest looking at R ( http://www.r-project.org/). There is a package available that may be what you are looking to do with the plot: http://www.exposurescience.org/heR.doc/library/heR.Misc/html/rose2.html "Creates a directional histogram, i.e., a rose diagram, representing data on direction, and possibly magnitude" The ggplot2 package is also very helpful in getting your data into a graph ( http://had.co.nz/ggplot2/). -ab On Wed, Aug 4, 2010 at 11:03 AM, Armen Ezekielian wrote: > I have a C program which outputs a six-column by N-row > data file for each time step of a simulation. The six columns > contain floats representing the coordinates and velocity > components for N particles. N is generally on the order of a > few hundred and there are at least 1000 of these files. > > x y z v_x v_y v_z > N of these lines --> 1.0 1.3 1.1 2.6 1.9 3.8 > > And as I said there is one of these files for each time step. > > I was hoping to use python to process these data files and > create a visualization using the visual.sphere() function > in VPython. I want to render a sphere at every x, y, z > point and color the spheres according to a colormap > based on the magnitude of the velocity (red = fast, > blue = slow). This would be done for each time step file > and then loop through them to create an animation. > > Unfortunately I have limited python experience and little > time to accomplish this. If anyone has any tips/suggestions > on how to do the file I/O I would be extremely grateful. I am > researching the problem myself but the majority of my time is > being spent helping the students debug/run their C programs > which produce the output files above. Thank you!!! > > --Armen > _______________________________________________ > CentralOH mailing list > CentralOH at python.org > http://mail.python.org/mailman/listinfo/centraloh > -- -ab -------------- next part -------------- An HTML attachment was scrubbed... URL: From eric at intellovations.com Mon Aug 9 20:59:32 2010 From: eric at intellovations.com (Eric Floehr) Date: Mon, 9 Aug 2010 14:59:32 -0400 Subject: [CentralOH] Python for Fun Message-ID: I wanted to share with you this awesome Python website I found. It contains walk-throughs and examples for all kinds of interesting things: http://openbookproject.net/py4fun/index.html Some examples are creating simple Lisp and Forth interpreters in Python, Towers of Hanoi, etc. -Eric From mark at microenh.com Tue Aug 10 12:11:15 2010 From: mark at microenh.com (Mark Erbaugh) Date: Tue, 10 Aug 2010 06:11:15 -0400 Subject: [CentralOH] Table widget for Tkinter Message-ID: <67712E28-0324-4CC0-AEC6-5C20C96744CB@microenh.com> Is anyone using a table-type widget in a Tkinter app? I'm looking for a way to display and edit rows and columns of data. I've used Tktable before but wonder if there is something better. What about Tix? Speaking of Tix, is anyone using that on a Mac? When I try a simple app, I get a TclError: can't find package Tix. Some googling finds that the Tix package isn't included in Mac versions of Python (either the standard one included with OSX or with the MacPython versions). Has anyone installed the Tix package? How do you do that? Thanks, Mark From james at atlantixeng.com Wed Aug 11 14:17:09 2010 From: james at atlantixeng.com (James - Atlantix) Date: Wed, 11 Aug 2010 08:17:09 -0400 Subject: [CentralOH] GUI Tools In-Reply-To: References: Message-ID: <007101cb394f$1ff52430$5fdf6c90$@com> This is a subject that is a little different than the Tk question just posed, but I'm wondering how many prefer to use a GUI tool such as Tk, WxPython, PyQt, or VTK versus a web based GUI / framework? My work demands standalone GUI's, but much effort of late uses web based GUIs. This would be an interesting survey question. Thanks, James -----Original Message----- From: centraloh-bounces+james=atlantixeng.com at python.org [mailto:centraloh-bounces+james=atlantixeng.com at python.org] On Behalf Of centraloh-request at python.org Sent: Wednesday, August 11, 2010 6:00 AM To: centraloh at python.org Subject: CentralOH Digest, Vol 40, Issue 6 Send CentralOH mailing list submissions to centraloh at python.org To subscribe or unsubscribe via the World Wide Web, visit http://mail.python.org/mailman/listinfo/centraloh or, via email, send a message with subject or body 'help' to centraloh-request at python.org You can reach the person managing the list at centraloh-owner at python.org When replying, please edit your Subject line so it is more specific than "Re: Contents of CentralOH digest..." Today's Topics: 1. Table widget for Tkinter (Mark Erbaugh) ---------------------------------------------------------------------- Message: 1 Date: Tue, 10 Aug 2010 06:11:15 -0400 From: Mark Erbaugh To: centraloh Subject: [CentralOH] Table widget for Tkinter Message-ID: <67712E28-0324-4CC0-AEC6-5C20C96744CB at microenh.com> Content-Type: text/plain; charset=us-ascii Is anyone using a table-type widget in a Tkinter app? I'm looking for a way to display and edit rows and columns of data. I've used Tktable before but wonder if there is something better. What about Tix? Speaking of Tix, is anyone using that on a Mac? When I try a simple app, I get a TclError: can't find package Tix. Some googling finds that the Tix package isn't included in Mac versions of Python (either the standard one included with OSX or with the MacPython versions). Has anyone installed the Tix package? How do you do that? Thanks, Mark ------------------------------ _______________________________________________ CentralOH mailing list CentralOH at python.org http://mail.python.org/mailman/listinfo/centraloh End of CentralOH Digest, Vol 40, Issue 6 **************************************** From issac.kelly at gmail.com Wed Aug 11 14:32:54 2010 From: issac.kelly at gmail.com (Issac Kelly) Date: Wed, 11 Aug 2010 08:32:54 -0400 Subject: [CentralOH] GUI Tools In-Reply-To: <007101cb394f$1ff52430$5fdf6c90$@com> References: <007101cb394f$1ff52430$5fdf6c90$@com> Message-ID: We prefer web-based GUIs, but I think it ultimately depends on your other constraints. 1) Do you have a server that all of the users will have access to? 2) Do you need to maintain close control over source updates and deployment? 3) Will everyone have network access? Could it be a javascript only app (HTML5/Offilne as well) Just a couple of things to think about. On Wed, Aug 11, 2010 at 8:17 AM, James - Atlantix wrote: > This is a subject that is a little different than the Tk question just > posed, but I'm wondering how many prefer to use a GUI tool such as Tk, > WxPython, PyQt, or VTK versus a web based GUI / framework? My work demands > standalone GUI's, but much effort of late uses web based GUIs. This would > be > an interesting survey question. > Thanks, > James > > -----Original Message----- > From: centraloh-bounces+james=atlantixeng.com at python.org > [mailto:centraloh-bounces+james = > atlantixeng.com at python.org] On Behalf Of > centraloh-request at python.org > Sent: Wednesday, August 11, 2010 6:00 AM > To: centraloh at python.org > Subject: CentralOH Digest, Vol 40, Issue 6 > > Send CentralOH mailing list submissions to > centraloh at python.org > > To subscribe or unsubscribe via the World Wide Web, visit > http://mail.python.org/mailman/listinfo/centraloh > or, via email, send a message with subject or body 'help' to > centraloh-request at python.org > > You can reach the person managing the list at > centraloh-owner at python.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of CentralOH digest..." > > > Today's Topics: > > 1. Table widget for Tkinter (Mark Erbaugh) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Tue, 10 Aug 2010 06:11:15 -0400 > From: Mark Erbaugh > To: centraloh > Subject: [CentralOH] Table widget for Tkinter > Message-ID: <67712E28-0324-4CC0-AEC6-5C20C96744CB at microenh.com> > Content-Type: text/plain; charset=us-ascii > > Is anyone using a table-type widget in a Tkinter app? I'm looking for a > way > to display and edit rows and columns of data. I've used Tktable before but > wonder if there is something better. What about Tix? > > Speaking of Tix, is anyone using that on a Mac? When I try a simple app, I > get a TclError: can't find package Tix. Some googling finds that the Tix > package isn't included in Mac versions of Python (either the standard one > included with OSX or with the MacPython versions). Has anyone installed > the > Tix package? How do you do that? > > Thanks, > Mark > > > > > ------------------------------ > > _______________________________________________ > CentralOH mailing list > CentralOH at python.org > http://mail.python.org/mailman/listinfo/centraloh > > > End of CentralOH Digest, Vol 40, Issue 6 > **************************************** > > _______________________________________________ > CentralOH mailing list > CentralOH at python.org > http://mail.python.org/mailman/listinfo/centraloh > -------------- next part -------------- An HTML attachment was scrubbed... URL: From eric at intellovations.com Wed Aug 11 15:05:36 2010 From: eric at intellovations.com (Eric Floehr) Date: Wed, 11 Aug 2010 09:05:36 -0400 Subject: [CentralOH] GUI Tools In-Reply-To: <007101cb394f$1ff52430$5fdf6c90$@com> References: <007101cb394f$1ff52430$5fdf6c90$@com> Message-ID: Did you say survey? If you have a moment, could you please answer the two-page survey on GUI and web frameworks you use (or don't use) in Python? The first page is two questions about desktop GUI toolkits, and the second page is two questions about Python web frameworks. http://www.surveymonkey.com/s/RSNPXQL I'll collect the results and post to this list. Please publicize the link to your Twitter, Facebook, etc. I think the results could be very interesting! Cheers, Eric On Wed, Aug 11, 2010 at 8:17 AM, James - Atlantix wrote: > This is a subject that is a little different than the Tk question just > posed, but I'm wondering how many prefer to use a GUI tool such as Tk, > WxPython, PyQt, or VTK versus a web based GUI / framework? My work demands > standalone GUI's, but much effort of late uses web based GUIs. This would > be > an interesting survey question. > Thanks, > James > > -----Original Message----- > From: centraloh-bounces+james=atlantixeng.com at python.org > [mailto:centraloh-bounces+james = > atlantixeng.com at python.org] On Behalf Of > centraloh-request at python.org > Sent: Wednesday, August 11, 2010 6:00 AM > To: centraloh at python.org > Subject: CentralOH Digest, Vol 40, Issue 6 > > Send CentralOH mailing list submissions to > centraloh at python.org > > To subscribe or unsubscribe via the World Wide Web, visit > http://mail.python.org/mailman/listinfo/centraloh > or, via email, send a message with subject or body 'help' to > centraloh-request at python.org > > You can reach the person managing the list at > centraloh-owner at python.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of CentralOH digest..." > > > Today's Topics: > > 1. Table widget for Tkinter (Mark Erbaugh) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Tue, 10 Aug 2010 06:11:15 -0400 > From: Mark Erbaugh > To: centraloh > Subject: [CentralOH] Table widget for Tkinter > Message-ID: <67712E28-0324-4CC0-AEC6-5C20C96744CB at microenh.com> > Content-Type: text/plain; charset=us-ascii > > Is anyone using a table-type widget in a Tkinter app? I'm looking for a > way > to display and edit rows and columns of data. I've used Tktable before but > wonder if there is something better. What about Tix? > > Speaking of Tix, is anyone using that on a Mac? When I try a simple app, I > get a TclError: can't find package Tix. Some googling finds that the Tix > package isn't included in Mac versions of Python (either the standard one > included with OSX or with the MacPython versions). Has anyone installed > the > Tix package? How do you do that? > > Thanks, > Mark > > > > > ------------------------------ > > _______________________________________________ > CentralOH mailing list > CentralOH at python.org > http://mail.python.org/mailman/listinfo/centraloh > > > End of CentralOH Digest, Vol 40, Issue 6 > **************************************** > > _______________________________________________ > CentralOH mailing list > CentralOH at python.org > http://mail.python.org/mailman/listinfo/centraloh > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jonebird at gmail.com Wed Aug 11 15:09:36 2010 From: jonebird at gmail.com (Jon Miller) Date: Wed, 11 Aug 2010 09:09:36 -0400 Subject: [CentralOH] GUI Tools In-Reply-To: <007101cb394f$1ff52430$5fdf6c90$@com> References: <007101cb394f$1ff52430$5fdf6c90$@com> Message-ID: I'm on the web framework camp for this debate. It was the richness and availability of the web taking away the need for a standalone GUI that first got me into web programming. If I needed to create a standalone application, I'd probably see if I could get away with having my app fire up it's own webserver. Perhaps import the 'webbrowser' module and try to open a tab in the person's browser to go to the correct URL. -- Jon Miller On Wed, Aug 11, 2010 at 8:17 AM, James - Atlantix wrote: > This is a subject that is a little different than the Tk question just > posed, but I'm wondering how many prefer to use a GUI tool such as Tk, > WxPython, PyQt, or VTK versus a web based GUI / framework? My work demands > standalone GUI's, but much effort of late uses web based GUIs. This would be > an interesting survey question. > Thanks, > James > > -----Original Message----- > From: centraloh-bounces+james=atlantixeng.com at python.org > [mailto:centraloh-bounces+james=atlantixeng.com at python.org] On Behalf Of > centraloh-request at python.org > Sent: Wednesday, August 11, 2010 6:00 AM > To: centraloh at python.org > Subject: CentralOH Digest, Vol 40, Issue 6 > > Send CentralOH mailing list submissions to > ? ? ? ?centraloh at python.org > > To subscribe or unsubscribe via the World Wide Web, visit > ? ? ? ?http://mail.python.org/mailman/listinfo/centraloh > or, via email, send a message with subject or body 'help' to > ? ? ? ?centraloh-request at python.org > > You can reach the person managing the list at > ? ? ? ?centraloh-owner at python.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of CentralOH digest..." > > > Today's Topics: > > ? 1. Table widget for Tkinter (Mark Erbaugh) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Tue, 10 Aug 2010 06:11:15 -0400 > From: Mark Erbaugh > To: centraloh > Subject: [CentralOH] Table widget for Tkinter > Message-ID: <67712E28-0324-4CC0-AEC6-5C20C96744CB at microenh.com> > Content-Type: text/plain; charset=us-ascii > > Is anyone using a table-type widget in a Tkinter app? ?I'm looking for a way > to display and edit rows and columns of data. I've used Tktable before but > wonder if there is something better. ?What about Tix? > > Speaking of Tix, is anyone using that on a Mac? ?When I try a simple app, I > get a TclError: can't find package Tix. Some googling finds that the Tix > package isn't included in Mac versions of Python (either the standard one > included with OSX or with the MacPython versions). ?Has anyone installed the > Tix package? ?How do you do that? > > Thanks, > Mark > > > > > ------------------------------ > > _______________________________________________ > CentralOH mailing list > CentralOH at python.org > http://mail.python.org/mailman/listinfo/centraloh > > > End of CentralOH Digest, Vol 40, Issue 6 > **************************************** > > _______________________________________________ > CentralOH mailing list > CentralOH at python.org > http://mail.python.org/mailman/listinfo/centraloh > From james at atlantixeng.com Wed Aug 11 15:26:41 2010 From: james at atlantixeng.com (James - Atlantix) Date: Wed, 11 Aug 2010 09:26:41 -0400 Subject: [CentralOH] GUI Tools Survey In-Reply-To: References: Message-ID: <007801cb3958$d68aff90$83a0feb0$@com> The survey is a great idea, and hopefully will provide some very useful feedback. My main concern about Web based GUI's is the ability to add rich math content to them, such as with Matplotlib output. Has anyone any experience in this? From eric at intellovations.com Wed Aug 11 15:53:31 2010 From: eric at intellovations.com (Eric Floehr) Date: Wed, 11 Aug 2010 09:53:31 -0400 Subject: [CentralOH] GUI Tools Survey In-Reply-To: <007801cb3958$d68aff90$83a0feb0$@com> References: <007801cb3958$d68aff90$83a0feb0$@com> Message-ID: The book "Matplotlib for Python Developers" has an entire chapter on embedding Matplotlib output (or generating it in realtime) on the web, using a number of different frameworks: 1. CGI (via Apache's mod_cgi) 2. mod_python 3. Django 4. Pylons For Django (as that's what I'm familiar with) in your view code you use matplotlib.backends.backend_agg.FigureCanvasAgg as your canvas you plot the Figure on. Then instead of rendering a template response, you create an HttpResponse with content_type 'image/png' (or any of the types FigureCanvas supports) and print the bits to the response (the FigureCanvas takes a "file like" object or a string filename, and HttpResponse is a file-like object (i.e. has a write method)), like: fig = Figure() canvas = FigureCanvasAgg(fig) ... do your plot stuff ... response = django.http.HttpResonse(content_type='image/png') canvas.print_png(response) Only the last two lines are specific to the web framework, everything else is generic plot generation that can be used in a regular GUI, etc. So whatever URL you have defined for the image, it will return the png. -Eric On Wed, Aug 11, 2010 at 9:26 AM, James - Atlantix wrote: > The survey is a great idea, and hopefully will provide some very useful > feedback. My main concern about Web based GUI's is the ability to add rich > math content to them, such as with Matplotlib output. Has anyone any > experience in this? > > _______________________________________________ > CentralOH mailing list > CentralOH at python.org > http://mail.python.org/mailman/listinfo/centraloh > -------------- next part -------------- An HTML attachment was scrubbed... URL: From james at atlantixeng.com Wed Aug 11 15:47:02 2010 From: james at atlantixeng.com (James - Atlantix) Date: Wed, 11 Aug 2010 09:47:02 -0400 Subject: [CentralOH] GUI Tools & Python Libraries In-Reply-To: References: Message-ID: <008101cb395b$ae32e7d0$0a98b770$@com> Another question regading GUI tools (such as Pyjamas) that are for rich internet/browser applications is how well do they integrate Python libraries? For example, a library such as PySerial? Does anyone have experience with this? I know that Pyjamas compiles the Python to Javascript, but how well is this tested? Thanks, James From issac.kelly at gmail.com Wed Aug 11 15:38:24 2010 From: issac.kelly at gmail.com (Issac Kelly) Date: Wed, 11 Aug 2010 09:38:24 -0400 Subject: [CentralOH] GUI Tools Survey In-Reply-To: <007801cb3958$d68aff90$83a0feb0$@com> References: <007801cb3958$d68aff90$83a0feb0$@com> Message-ID: You could probably use something like latextohtml for formulas There are also lots of javascript libraries for generating plots and graphs, as well as a pretty robust API from google. On Wed, Aug 11, 2010 at 9:26 AM, James - Atlantix wrote: > The survey is a great idea, and hopefully will provide some very useful > feedback. My main concern about Web based GUI's is the ability to add rich > math content to them, such as with Matplotlib output. Has anyone any > experience in this? > > _______________________________________________ > CentralOH mailing list > CentralOH at python.org > http://mail.python.org/mailman/listinfo/centraloh > -------------- next part -------------- An HTML attachment was scrubbed... URL: From issac.kelly at gmail.com Wed Aug 11 16:06:01 2010 From: issac.kelly at gmail.com (Issac Kelly) Date: Wed, 11 Aug 2010 10:06:01 -0400 Subject: [CentralOH] GUI Tools Survey In-Reply-To: References: <007801cb3958$d68aff90$83a0feb0$@com> Message-ID: Hmm, saying 'canvas' is interesting as well, I'm sure that there is an SVG library somewhere, and that could be used with HTML5 canvas drawing (AFAIK) The problem will be browser support for a few (12?) more months On Wed, Aug 11, 2010 at 9:53 AM, Eric Floehr wrote: > The book "Matplotlib for Python Developers" has an entire chapter on > embedding Matplotlib output (or generating it in realtime) on the web, using > a number of different frameworks: > > 1. CGI (via Apache's mod_cgi) > 2. mod_python > 3. Django > 4. Pylons > > For Django (as that's what I'm familiar with) in your view code you use > matplotlib.backends.backend_agg.FigureCanvasAgg as your canvas you plot the > Figure on. Then instead of rendering a template response, you create an > HttpResponse with content_type 'image/png' (or any of the types FigureCanvas > supports) and print the bits to the response (the FigureCanvas takes a "file > like" object or a string filename, and HttpResponse is a file-like object > (i.e. has a write method)), like: > > fig = Figure() > canvas = FigureCanvasAgg(fig) > > ... do your plot stuff ... > > response = django.http.HttpResonse(content_type='image/png') > canvas.print_png(response) > > Only the last two lines are specific to the web framework, everything else > is generic plot generation that can be used in a regular GUI, etc. > > So whatever URL you have defined for the image, it will return the png. > > -Eric > > > On Wed, Aug 11, 2010 at 9:26 AM, James - Atlantix wrote: > >> The survey is a great idea, and hopefully will provide some very useful >> feedback. My main concern about Web based GUI's is the ability to add rich >> math content to them, such as with Matplotlib output. Has anyone any >> experience in this? >> >> _______________________________________________ >> CentralOH mailing list >> CentralOH at python.org >> http://mail.python.org/mailman/listinfo/centraloh >> > > > _______________________________________________ > CentralOH mailing list > CentralOH at python.org > http://mail.python.org/mailman/listinfo/centraloh > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From nludban at osc.edu Wed Aug 11 15:55:12 2010 From: nludban at osc.edu (Neil Ludban) Date: Wed, 11 Aug 2010 09:55:12 -0400 Subject: [CentralOH] GUI Tools Survey In-Reply-To: <007801cb3958$d68aff90$83a0feb0$@com> References: <007801cb3958$d68aff90$83a0feb0$@com> Message-ID: On Aug 11, 2010, at 9:26 AM, James - Atlantix wrote: > The survey is a great idea, and hopefully will provide some very useful > feedback. My main concern about Web based GUI's is the ability to add rich > math content to them, such as with Matplotlib output. Has anyone any > experience in this? Can't you save the matplotlib output as images to put in the web page? On the client (javascript) side: http://raphaeljs.com/ From godber at gmail.com Wed Aug 11 16:43:36 2010 From: godber at gmail.com (Austin Godber) Date: Wed, 11 Aug 2010 10:43:36 -0400 Subject: [CentralOH] GUI Tools Survey In-Reply-To: References: <007801cb3958$d68aff90$83a0feb0$@com> Message-ID: Here is a nice client side, javascript visualization library that uses SVG: http://vis.stanford.edu/protovis/ Here's another one: http://www.danvk.org/dygraphs/ Austin On Wed, Aug 11, 2010 at 10:06 AM, Issac Kelly wrote: > Hmm, saying 'canvas' is interesting as well, > I'm sure that there is an SVG library somewhere, and that could be used with > HTML5 canvas drawing (AFAIK) > The problem will be browser support for a few (12?) more months > > On Wed, Aug 11, 2010 at 9:53 AM, Eric Floehr > wrote: >> >> The book "Matplotlib for Python Developers" has an entire chapter on >> embedding Matplotlib output (or generating it in realtime) on the web, using >> a number of different frameworks: >> 1. CGI (via Apache's mod_cgi) >> 2. mod_python >> 3. Django >> 4. Pylons >> For Django (as that's what I'm familiar with) in your view code you use >> matplotlib.backends.backend_agg.FigureCanvasAgg as your canvas you plot the >> Figure on. ?Then instead of rendering a template response, you create an >> HttpResponse with content_type 'image/png' (or any of the types FigureCanvas >> supports) and print the bits to the response (the FigureCanvas takes a "file >> like" object or a string filename, and HttpResponse is a file-like object >> (i.e. has a write method)), like: >> fig = Figure() >> canvas = FigureCanvasAgg(fig) >> ... do your plot stuff ... >> response = django.http.HttpResonse(content_type='image/png') >> canvas.print_png(response) >> Only the last two lines are specific to the web framework, everything else >> is generic plot generation that can be used in a regular GUI, etc. >> So whatever URL you have defined for the image, it will return the png. >> -Eric >> >> On Wed, Aug 11, 2010 at 9:26 AM, James - Atlantix >> wrote: >>> >>> The survey is a great idea, and hopefully will provide some very useful >>> feedback. My main concern about Web based GUI's is the ability to add >>> rich >>> math content to them, such as with Matplotlib output. Has anyone any >>> experience in this? >>> >>> _______________________________________________ >>> CentralOH mailing list >>> CentralOH at python.org >>> http://mail.python.org/mailman/listinfo/centraloh >> >> >> _______________________________________________ >> CentralOH mailing list >> CentralOH at python.org >> http://mail.python.org/mailman/listinfo/centraloh >> > > > _______________________________________________ > CentralOH mailing list > CentralOH at python.org > http://mail.python.org/mailman/listinfo/centraloh > > From catherine.devlin at gmail.com Fri Aug 13 05:34:04 2010 From: catherine.devlin at gmail.com (Catherine Devlin) Date: Thu, 12 Aug 2010 23:34:04 -0400 Subject: [CentralOH] Fwd: [announcements] Columbus Code Camp In-Reply-To: <7A04D80E-534F-43E1-999B-C43A78DAFB17@cojug.org> References: <7A04D80E-534F-43E1-999B-C43A78DAFB17@cojug.org> Message-ID: In case anybody's interested... ---------- Forwarded message ---------- From: COJUG Annoucements Date: Thu, Aug 12, 2010 at 9:58 PM Subject: [announcements] Columbus Code Camp To: announcements at cojug.org A code camp is being organized to be held Saturday, October 16th @ TechColumbus. What's a code camp? It's a community event (following the Code Camp Manifesto -- see http://www.thedevcommunity.org/CodeCamps/Manifesto.aspx) where developers learn from their peers. Everyone is welcome to attend and speak. For more information, please visit http://columbuscodecamp.com. -------------------------------------------------------------------- You are currently subscribed to the COJUG announcements mailing list. To unsubscribe, e-mail: announcements-unsubscribe at cojug.org. For additional commands, email: announcements-help at cojug.org. -- - Catherine http://catherinedevlin.blogspot.com/ *** PyOhio 2010 * July 31 - Aug 1 * Columbus, OH * pyohio.org *** -------------- next part -------------- An HTML attachment was scrubbed... URL: From microenh at hughes.net Sat Aug 14 13:31:56 2010 From: microenh at hughes.net (Mark Erbaugh) Date: Sat, 14 Aug 2010 07:31:56 -0400 Subject: [CentralOH] Tkinter on Mac Message-ID: Is anyone using Tkinter on a Mac with Tk 8.5? It looks like the protocol handler for WM_DELETE_WINDOW is broken. I'm trying to use that protocol to catch when the user clicks on the close icon in the window bar (red dot) to close a window that has data that needs to be saved. The app displays a dialog giving the user the options YES, NO and CANCEL. If the user clicks CANCEL, the idea is that the window close is cancelled. This is supposedly handled by the protocol handler returning without calling .destroy(). This works on Windows XP with Tk 8.5, but on the Mac, the window is hidden from the screen. It doesn't look like it has been iconized (doesn't show up in the dock), but the app still acts like it's there, but it's not visible on the screen. I installed a newer version (2.6.5) of Mac Python, which ironically, installs Tk 8.4.x. WIth Tk 8.4, the WM_DELETE_WINDOW protocol handler seems to work properly. Mark From eric at intellovations.com Fri Aug 20 15:19:16 2010 From: eric at intellovations.com (Eric Floehr) Date: Fri, 20 Aug 2010 09:19:16 -0400 Subject: [CentralOH] Results of Python GUI Survey Message-ID: All, The responses have stabilized so, as promised, here are the results. 83 people completed the survey! Thank you all (you know who you are)! 59% (49 people) use Python to create desktop GUI applications. The following numbers will add up to more than 49 because people may use more than one GUI toolkit. 32 people said they use wxPython 16 people said they use PyQT/PyQT4 (11 for PyQT4, 5 for PyQT) 15 people said they use TkInter 11 people said they use PyGame 10 people said they use PyGTK 4 people said they use Jython (Java libs) 3 people said they use IronPython (.NET/Mono libs) 1 person said they use PyVTK/visual There were a number of other responses, each mentioned once: Pyglet, PythonCard, pyFltk, wax (wrapper around WxPython), PyOpenGL, and Traits/TraitsUI from Enthought (layered on top of either wxPython or PyQT). There was more uniformity for the web GUI question. 70% (55 people) of respondents use Python to create web GUIs (however 4 people who answered the first page of questions failed to answer the second page). 43 people said they use Django 11 people said they use web.py 7 people said they use TurboGears 7 people said they use Pylons 3 people said they use Tornado 3 people said they use Zope/Plone I obviously missed a couple of important toolkits, as there were 18 other responses (again a respondent could enter more than one), which were: 6 people mentioned CherryPy 4 people mentioned flask 3 people mentioned repoze.bfg 2 people mentioned Google Appengine 2 people mentioned bottle.py And one each for mnml, oort, CGI, werkzeug, bobo, and pyjamas. I hope you find this informative and insightful. Thanks again all who participated! Best Regards, Eric -------------- next part -------------- An HTML attachment was scrubbed... URL: From mark at microenh.com Sun Aug 22 03:07:29 2010 From: mark at microenh.com (Mark Erbaugh) Date: Sat, 21 Aug 2010 21:07:29 -0400 Subject: [CentralOH] SQLAlchemy Message-ID: <8F637EFB-8EFC-46A9-A150-DC48DBD51CF9@microenh.com> I've run into an issue with SQLAlchemy dealing with a parent child relationship. I'm using Python 2.6 and SQLAlchemy 0.5.8 with a SQLite in memory database for testing. According to the SQLAlchemy docs, SA can use lists or sets as the container for child objects If I use a list as the container for the child objects, things seem to work properly. If I use a set as the container for the child objects and add a new child object and commit the session, the data is updated to the database correctly. If I delete a child object, the corresponding record in the database isn't getting deleted. To get the set working (this far), I added __hash__, __cmp__ and __eq__ methods to the child class so that instances with the same data compare equally and hash to the same value so that only one instance with the same data can be added. Mark From james at atlantixeng.com Sun Aug 22 17:00:23 2010 From: james at atlantixeng.com (James - Atlantix) Date: Sun, 22 Aug 2010 11:00:23 -0400 Subject: [CentralOH] Python 2.6 on Windows XP Message-ID: <00c801cb420a$bfbbe760$3f33b620$@com> I've had two different instances where updates to Windows XP has crashed my Python installation. One was about 2 months ago, and the other this past week. It seems as if something happens to the Python internals when this happens. I run Python on Windows Vista 32 and 64 bit, and Windows 7 64 bit with no problem. Thoughts on why the XP updates are crashing Python? Thanks, James -------------- next part -------------- An HTML attachment was scrubbed... URL: From miles.groman at gmail.com Sun Aug 22 17:12:11 2010 From: miles.groman at gmail.com (m g) Date: Sun, 22 Aug 2010 11:12:11 -0400 Subject: [CentralOH] SQLAlchemy In-Reply-To: <8F637EFB-8EFC-46A9-A150-DC48DBD51CF9@microenh.com> References: <8F637EFB-8EFC-46A9-A150-DC48DBD51CF9@microenh.com> Message-ID: > If I use a set as the container for the child objects and add a new child object and commit the session, the data is updated to the database correctly. If I delete a child object, the corresponding record in the database isn't getting deleted. > del child_object or session.delete(child_object) ? From mark at microenh.com Mon Aug 23 13:29:11 2010 From: mark at microenh.com (Mark Erbaugh) Date: Mon, 23 Aug 2010 07:29:11 -0400 Subject: [CentralOH] SQLAlchemy In-Reply-To: References: <8F637EFB-8EFC-46A9-A150-DC48DBD51CF9@microenh.com> Message-ID: <8C4FF2F3-8131-4774-B0CA-518CD7EB937E@microenh.com> On Aug 22, 2010, at 11:12 AM, m g wrote: >> If I use a set as the container for the child objects and add a new child object and commit the session, the data is updated to the database correctly. If I delete a child object, the corresponding record in the database isn't getting deleted. >> > > del child_object > > or > > session.delete(child_object) ? Thanks. I think that was indirectly part of the problem. The problem appears to be either with my understanding of sets or the instrumentation that SQLAlchemy adds. I've got something that works (it passed my unittests), but it's not as elegant as I would like. In short, while I was able to create an object that could be added and removed from a SA InstrumentedSet, it looks like the instrumentation that SA adds wasn't correctly detecting removal of objects. I had to remove the object by brute force (iterate through the set to find the exact object to remove and remove that object) to get SA to recognize it. Mark From mark at microenh.com Wed Aug 25 22:16:49 2010 From: mark at microenh.com (Mark Erbaugh) Date: Wed, 25 Aug 2010 16:16:49 -0400 Subject: [CentralOH] SQLAlchemy Message-ID: <767C5227-24C4-42F2-8FE7-F1B88CB8C5CC@microenh.com> By default, SQLAlchemy converts child rows in a 1:N relationship into a Python list and instruments that list so that when you write the parent object back to the database, inserts, updates and deletes are issued to bring the database table in line with the local version. OTOH, if you query a table, you can get multiple rows back also in a Python list. But this list is not instrumented and it seems like you have to manually manage the session object to keep it in sync with changes to the list. I have a use case where the user will be editing rows from an entire table in a single GUI screen. It's possible that in addition to editing existing rows, the user can add new rows and delete existing rows. At first pass, I though I could use the session's add() and delete() methods. but I've run into a minor problem. It is possible that a user could add a new row then decide to delete that row before committing the changes to the database. It looks like SQLAlchemy doesn't like to delete a row that hasn't been persisted to the database. To remove a row that hasn't been persisted, you need to call the session's expunge() method. It seems like I'm going to have to keep track of the status of the individual rows so I can properly apply add(), delete() and expunge() calls, but this seems like I may be duplicating something that SQLAlchemy already does when managing a child collection. Or, am I trying to do to much? Should the GUI retrieve and write individual rows as the user edits the table? In this particular use case, there's no real need to do all the updates at once as the edits to each individual row are independent. Thanks, Mark From miles.groman at gmail.com Thu Aug 26 00:15:10 2010 From: miles.groman at gmail.com (m g) Date: Wed, 25 Aug 2010 18:15:10 -0400 Subject: [CentralOH] SQLAlchemy In-Reply-To: <767C5227-24C4-42F2-8FE7-F1B88CB8C5CC@microenh.com> References: <767C5227-24C4-42F2-8FE7-F1B88CB8C5CC@microenh.com> Message-ID: Hi Mark, Have you looked at the session attributes? http://www.sqlalchemy.org/docs/05/session.html#session-attributes From mark at microenh.com Thu Aug 26 01:17:43 2010 From: mark at microenh.com (Mark Erbaugh) Date: Wed, 25 Aug 2010 19:17:43 -0400 Subject: [CentralOH] SQLAlchemy In-Reply-To: References: <767C5227-24C4-42F2-8FE7-F1B88CB8C5CC@microenh.com> Message-ID: On Aug 25, 2010, at 6:15 PM, m g wrote: > Hi Mark, > > Have you looked at the session attributes? > > http://www.sqlalchemy.org/docs/05/session.html#session-attributes > _______________________________________________ > CentralOH mailing list > CentralOH at python.org > http://mail.python.org/mailman/listinfo/centraloh Thanks for the tip. I was aware of the new, dirty and deleted attribute, but missed the iterator and in ones. Mark From microenh at hughes.net Fri Aug 27 02:25:40 2010 From: microenh at hughes.net (Mark Erbaugh) Date: Thu, 26 Aug 2010 20:25:40 -0400 Subject: [CentralOH] Tkinter Checkbutton Message-ID: <873BF358-ACF5-4301-9AD0-10A3D9F946B7@hughes.net> I would like to place some Tkinter Checkbutton's on a Canvas. When I use a Frame and the Pack geometry manager, it knows the appropriate height of the Checkbutton so that that it can align them properly. Is there a way for me to determine the height of a Checkbutton when placing it on a canvas? I tried using the Checkbutton's font height, but the indicator (checkmark box) is taller. Thanks, Mark From mark at microenh.com Fri Aug 27 13:47:50 2010 From: mark at microenh.com (Mark Erbaugh) Date: Fri, 27 Aug 2010 07:47:50 -0400 Subject: [CentralOH] Tkinter Checkbutton In-Reply-To: <873BF358-ACF5-4301-9AD0-10A3D9F946B7@hughes.net> References: <873BF358-ACF5-4301-9AD0-10A3D9F946B7@hughes.net> Message-ID: <7F1AE7DD-B45B-4C5F-B222-A25724E0B685@microenh.com> On Aug 26, 2010, at 8:25 PM, Mark Erbaugh wrote: > I would like to place some Tkinter Checkbutton's on a Canvas. When I use a Frame and the Pack geometry manager, it knows the appropriate height of the Checkbutton so that that it can align them properly. Is there a way for me to determine the height of a Checkbutton when placing it on a canvas? I tried using the Checkbutton's font height, but the indicator (checkmark box) is taller. > I figured it out: use the Checkbutton's winfo_reqheight method Mark From riqemail at gmail.com Mon Aug 30 22:54:41 2010 From: riqemail at gmail.com (Tony Zhu) Date: Mon, 30 Aug 2010 16:54:41 -0400 Subject: [CentralOH] List in config file Message-ID: I need to store some tasks configuration in a config file. We had a old similar program in perl, which uses the Config::Natural module. By that, the config file can be written as: task{ name=task1 tools=(tool1 tool2) } task{ name=task2 tools=(tool2 tool3) } There can be more "task" sections, which could be read into an array by the perl config module. But I tried the "ConfigParser" package in python, it does not support such lists. I thought about xml. Of course it can store such data. But the config file is supposed to be edited by hand. xml is not so friendly to a notepad. I also checked YAML, plists, json. All of them seem to be too complex for my simple requirement. Does anyone have some python package to recommend? Thanks Kunpeng (Tony) Zhu -------------- next part -------------- An HTML attachment was scrubbed... URL: From douglas.m.stanley at gmail.com Mon Aug 30 23:17:52 2010 From: douglas.m.stanley at gmail.com (Douglas Stanley) Date: Mon, 30 Aug 2010 17:17:52 -0400 Subject: [CentralOH] List in config file In-Reply-To: References: Message-ID: On Mon, Aug 30, 2010 at 4:54 PM, Tony Zhu wrote: > I need to store some tasks configuration in a config file. We had a old > similar program in perl, which uses the Config::Natural module. By that, the > config file can be written as: > task{ > ?? ?name=task1 > ?? ?tools=(tool1 > ?? ? ? ? ? ? ?tool2) > } > task{ > ?? ?name=task2 > ?? ?tools=(tool2 > ?? ? ? ? ? ? tool3) > } > There can be more "task" sections, which could be read into an array by the > perl config module. > But I tried the "ConfigParser" package in python, it does not support such > lists. > I thought about xml. Of course it can store such data. But the config file > is?supposed?to be edited by hand. xml is not so friendly to a notepad. I > also checked YAML, plists, json. All of them seem to be too complex for my > simple requirement. > Does anyone have some python package to?recommend? > Thanks > Kunpeng (Tony) Zhu > Check out configobj: http://www.voidspace.org.uk/python/configobj.html It's similar to configparser (in that it uses ini-like files), but adds things like list support, and nested sections. Doug -- Please avoid sending me Word or PowerPoint attachments. See http://www.gnu.org/philosophy/no-word-attachments.html From wam at cisco.com Mon Aug 30 23:36:40 2010 From: wam at cisco.com (William McVey) Date: Mon, 30 Aug 2010 17:36:40 -0400 Subject: [CentralOH] List in config file In-Reply-To: References: Message-ID: <1283204200.26331.23.camel@goldfinger> On Mon, 2010-08-30 at 16:54 -0400, Tony Zhu wrote: > I need to store some tasks configuration in a config file. > > But I tried the "ConfigParser" package in python, it does not support > such lists. > I thought about xml. Of course it can store such data. But the config > file is supposed to be edited by hand. xml is not so friendly to a > notepad. I also checked YAML, plists, json. All of them seem to be too > complex for my simple requirement. > How are you defining "complex". I would tend to choose YAML for this kind of config file, and although yaml has support for a lot of constructs, using the yaml to parse simple (or complex) config files really isn't complex itself. For instance: # Config file demo: foo.yaml # tasks: task1: - tool1 - tool2 task2: # another way to do it tools: [tool2, tool3] And loading the config: >>> import yaml >>> f = open("/tmp/foo.yaml") >>> doc = yaml.load(f) >>> doc['tasks']['task1'] ['tool1', 'tool2'] >>> doc['tasks']['task2']['tools'] ['tool2', 'tool3'] In fact, load() simply builds a structured dictionary that you can process however you wish: >>> doc {'tasks': {'task1': ['tool1', 'tool2'], 'task2': {'tools': ['tool2', 'tool3']}}} Hope this helps. -- William From josh at globalherald.net Mon Aug 30 23:17:39 2010 From: josh at globalherald.net (Joshua Kramer) Date: Mon, 30 Aug 2010 17:17:39 -0400 (EDT) Subject: [CentralOH] List in config file In-Reply-To: References: Message-ID: Hello Tony, Check out the settings.py file of any Django project. Django uses lists in its configuration. Cheers, -Josh -- ----- http://www.globalherald.net/jb01 GlobalHerald.NET, the Smarter Social Network! (tm) From eric at intellovations.com Tue Aug 31 14:27:52 2010 From: eric at intellovations.com (Eric Floehr) Date: Tue, 31 Aug 2010 08:27:52 -0400 Subject: [CentralOH] Hacker Session Notes In-Reply-To: References: Message-ID: Sounds like a great session, Scott! On Tue, Aug 31, 2010 at 8:18 AM, scitesy wrote: > More goodness was had at the PythonDoJoe with Chris Folsom and Bryan > Patterson. > > We looked at and strategized Bryan's pyjamas code and I coded the > Python DoJoe Flask web site. We also briefly looked at Chris's > PurView web framework on ohlo. Chris also learned more about python > by reading Learning Python. > > I'll be pushing the Python DoJoe changes either tonight or tomorrow > morning. Next week for me, will be all about improving the Central > Ohio Python User Group (cohpy) web site. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From eric at intellovations.com Tue Aug 31 20:24:14 2010 From: eric at intellovations.com (Eric Floehr) Date: Tue, 31 Aug 2010 14:24:14 -0400 Subject: [CentralOH] Ohio Linux Fest 9/11/2010 PyOhio/Python table Message-ID: All, As mentioned at last night's meeting, PyOhio will have a Python table at the Ohio Linux Fest this year. The main day is Saturday the 11th. I will be bringing a few books from the COhPy library as well as fliers for The Central Ohio Python User's group. I am sure there will be some fliers from other Ohio Python orgs as well as additional materials. Thanks for those that volunteered to man the table for an hour or two. The Ohio Linux fest has some great talks, and has a very large display area with many of the big players there. Manning the booth is a great way to meet new folks and chat about a great language. I'll be manning the booth with my 11-year-old daughter, who has just recently started programming Python using the "Hello World" book I mentioned in my PyOhio lightning talk. See you there! Eric -------------- next part -------------- An HTML attachment was scrubbed... URL: From riqemail at gmail.com Tue Aug 31 21:08:32 2010 From: riqemail at gmail.com (Tony Zhu) Date: Tue, 31 Aug 2010 15:08:32 -0400 Subject: [CentralOH] List in config file In-Reply-To: References: Message-ID: I finally decided to use YAML to store the settings. I found Google's app-engine is using yaml as the config file too. Following Google should not be a bad idea :-P I checked the configobj, its list support does not satisfy my requirement. And I do not want the config file to be runnable as a .py document. I also tested the json. But unbelievably, python's json implement does not support comments in the json file. How can I let my user modify a config file without any comments in the example file! Now I am ready to move on with some real functions controlled by the config file. Thank you for all your help! Kunpeng (Tony) Zhu Ohio Supercomputer Center On Mon, Aug 30, 2010 at 5:17 PM, Joshua Kramer wrote: > > Hello Tony, > > Check out the settings.py file of any Django project. Django uses lists in > its configuration. > > Cheers, > -Josh > > -- > > ----- > http://www.globalherald.net/jb01 > GlobalHerald.NET, the Smarter Social Network! (tm) > > _______________________________________________ > CentralOH mailing list > CentralOH at python.org > http://mail.python.org/mailman/listinfo/centraloh > -------------- next part -------------- An HTML attachment was scrubbed... URL: From brian.costlow at gmail.com Tue Aug 31 22:31:56 2010 From: brian.costlow at gmail.com (Brian Costlow) Date: Tue, 31 Aug 2010 16:31:56 -0400 Subject: [CentralOH] List in config file In-Reply-To: References: Message-ID: > > I also tested the json. But unbelievably, python's json implement does not > support comments in the json file. How can I let my user modify a config > file without any comments in the example file! > > Comments are not part of the json spec. JavaScript style comments were in an early draft, but were later removed. So, Python's behavior is correct. Makes sense, as json was really intended as an over-the-wire protocol, and not as a conf file format. -------------- next part -------------- An HTML attachment was scrubbed... URL: