my.utoronto.ca | UofT | A & S | DCS | CDF | my CDF | UGA
 
Welcome, Guest. Please Login.
Aug 20th, 2009, 11:48am
U of T Undergraduate
Computer Science Community
Home Help Search Login


Pages: 1 2 
Send Topic Print
New media.py and picture.py for project (Read 1667 times)
Paul Gries
Administrator
Instructor
*****




Posts: 717
Show the link to this post New media.py and picture.py for project
Nov 11th, 2008, 6:24pm
 
There is a subtle threading bug in the media code that interferes with some Tkinter functionality, and that bug manifests itself differently on each operating system.
 
We have a fairly easy fix, which we will discuss in lecture this week:
  • Download NEW files media.py and picture.py.
  • Put those files in your project directory.  That way when you import media, your program will find these new files.

 
Notes:
 
This fix has only been tested in OS X.  If you happen to test this fix on Windows or Linux, could you please post a note letting us know whether it worked?
 
Functions media.show and media.update have changed.  They now both open a new window every time you call them, no matter what.  And you can't close them, unfortunately.
 
Fortunately, we're going to show you how to put images into your Tkinter windows so you won't need to use media.show any more (except perhaps during your testing).  If you're curious, you can take a look at an example, which we're going to discuss later this week.
Back to top
 
 
  IP Logged
c8tempel
Ex Member



Show the link to this post Re: New media.py and picture.py for project
Reply #1 - Nov 11th, 2008, 9:24pm
 
I dropped in these two modules (working on ubuntu). Now when I open a file in my own GUI, the picture appears in eog (a Gnome image viewer that has rotate built-in  lips sealed).
Back to top
 
 
  IP Logged
Paul Gries
Administrator
Instructor
*****




Posts: 717
Show the link to this post Re: New media.py and picture.py for project
Reply #2 - Nov 11th, 2008, 9:51pm
 
That's with media.show, though, isn't it?  The sample code shows how to embed a picture into a regular Tkinter window, which is closer to a real UI.
Back to top
 
 
  IP Logged
c8bergmi

Student





Posts: 271
Show the link to this post Re: New media.py and picture.py for project
Reply #3 - Nov 12th, 2008, 2:30pm
 
Can we save media.py over C:\Python25\Lib\site-packages\pygraphics\media.py?
Or, is that not a good idea?
Back to top
 
 
  IP Logged
David
Ex Member



Show the link to this post Re: New media.py and picture.py for project
Reply #4 - Nov 14th, 2008, 12:26am
 
How come all the profs use Macs (hence the lack of testing outside OS X)? Does Apple give a big discount to the staff, or do you find Macs better than PCs?
Back to top
 
 
  IP Logged
jono
Moderator
Teaching Assistant
*****


hot dog

Posts: 1092
Show the link to this post Re: New media.py and picture.py for project
Reply #5 - Nov 14th, 2008, 8:14am
 
Quote from c8bergmi on Nov 12th, 2008, 2:30pm:
Can we save media.py over C:\Python25\Lib\site-packages\pygraphics\media.py?
Or, is that not a good idea?

It's probably a good idea to rename the original so that if anything goes wrong, you can always revert back to it.
 
Quote from David on Nov 14th, 2008, 12:26am:
How come all the profs use Macs (hence the lack of testing outside OS X)? Does Apple give a big discount to the staff, or do you find Macs better than PCs?

To answer your hypothesis, AFAIK, staff and faculty get the same academic discounts as students; while research faculty can save the GST (or was that PST?) if the computer is being used for research, my understanding is that this applies to any and all equipment being used for that purpose.
 
In answer to your main question, i'm not a prof, but... (answer edited for brevity) it fit my needs/wants better than the alternatives i was considering.
Back to top
 
 

throw me a bone!
WWW   IP Logged
RobbieCrash

Student





Posts: 92
Show the link to this post Re: New media.py and picture.py for project
Reply #6 - Nov 14th, 2008, 12:42pm
 
Quote from David on Nov 14th, 2008, 12:26am:
How come all the profs use Macs (hence the lack of testing outside OS X)? Does Apple give a big discount to the staff, or do you find Macs better than PCs?

 
"They just work"©
Back to top
 
 
  IP Logged
Paul Gries
Administrator
Instructor
*****




Posts: 717
Show the link to this post Re: New media.py and picture.py for project
Reply #7 - Nov 14th, 2008, 1:08pm
 
I use it for (at least) the following reasons:
  • It's built on BSD Unix, and includes a regular command-line interface so I can ssh into CDF, including X forwarding.
  • The applications are top-notch: Apple's Keynote, for example, compares favourably with PowerPoint.
  • I can (and do) use Microsoft Office.
  • My favourite text editor ever is TextMate, which is OS X-only.  It's the first text editor I've ever paid money for, and it is SO worth it.  It speaks HTML, LaTeX, Python, Java, C, XML, and so much more, and it's my most-used application.
  • It comes with X11, which is a standard Unix/Linux windowing system, so I can install lots of X11 apps.
  • I occasionally boot my Mac into Windows XP.

Back to top
 
 
  IP Logged
Simmon

Student





Posts: 180
Show the link to this post Re: New media.py and picture.py for project
Reply #8 - Nov 14th, 2008, 6:59pm
 
For a laptop, I can see the reason for Macbooks, there aren't any really really nice laptops running Linux... the Dell ones are an eye sore. (Their Linux ones anyway)
Back to top
 
 
  IP Logged
Nick
Ex Member



Show the link to this post Re: New media.py and picture.py for project
Reply #9 - Nov 14th, 2008, 7:11pm
 
Having used TextMate when I had a Mac, I think I understand why Paul likes it so much. I wrote in Ruby at some point and I settled with it... simply the best editor Smiley
 
It is a torture for me when Paul fires up Wing every time... and today, especially, when what seemed like a bug in X11 took away maybe 5 minutes of the lecture (okay, maybe that wasn't related with Wing...)
 
I even remember the guys from 37Signals saying they all switched to Mac primarily because of TextMate. So, to all of you who haven't tried TextMate yet: find a friend with a Mac and try it Smiley
Back to top
 
 

 
  IP Logged
jan

Student





Posts: 183
Show the link to this post Re: New media.py and picture.py for project
Reply #10 - Nov 15th, 2008, 1:58pm
 
Every now and then, I'm getting the following errors with the new media/picture modules and media.show on Ubuntu 8.10 (showing pics in EOG)
 
Quote:
(eog:6982): GLib-GObject-CRITICAL **: g_object_unref: assertion `G_IS_OBJECT (object)' failed

Quote:
(eog:7047): GLib-WARNING **: GError set over the top of a previous GError or uninitialized memory.
This indicates a bug in someone's code. You must ensure an error is NULL before it's set.
The overwriting error message was: Error in getting image file info

 
I think the latter may occur when calling show on multiple pics, but I've yet to find the direct sequence of events to repeat the error.  It's not a major issue as I'm just using show for some command line testing. I just thought I'd point it out.
 
One more! EOG will occasionally display the following without raising an exception: (again, I think this has to do with multiple pic windows)
 
Quote:
No images found in file:///tmp/tmpBLAHBLAH

 
where BLAHBLAH is the random filename.
Back to top
 
 
  IP Logged
Simmon

Student





Posts: 180
Show the link to this post Re: New media.py and picture.py for project
Reply #11 - Nov 15th, 2008, 5:44pm
 
I've made slight changes to media.py and picture.py (just some small things), will I be able to guarantee that my GUI will run with the media.py and picture.py modules I include? (I would assume so, as they will be submitted as part of my package) I just wanted to be clear.
 
Thanks!
Back to top
 
 
  IP Logged
Paul Gries
Administrator
Instructor
*****




Posts: 717
Show the link to this post Re: New media.py and picture.py for project
Reply #12 - Nov 17th, 2008, 8:41am
 
Sure: if you modify them, please submit them.  But please add a description of what you changed.
Back to top
 
 
  IP Logged
Simmon

Student





Posts: 180
Show the link to this post Re: New media.py and picture.py for project
Reply #13 - Nov 18th, 2008, 1:07am
 
Should this be in the file headers?
Back to top
 
 
  IP Logged
RobbieCrash

Student





Posts: 92
Show the link to this post Re: New media.py and picture.py for project
Reply #14 - Nov 19th, 2008, 5:36am
 
Anyone other than me having issues with media.show() on Vista?
 
I'm just trying to test functions without tossing them into the GUI and every time I try to show a picture, Windows Picture Viewer opens saying nothing's loaded.
 
This happens in Wing, Idle and in the interactive prompt.
Back to top
 
 
  IP Logged
Pages: 1 2 
Send Topic Print