[Tutor] Rebuild jpg

2011-02-21 Thread Rafael Durán Castañeda
Hi all,

I'm using Python 3.1 and I have an image of an animal that  has been broken
it into many narrow vertical stripe images, and now i want to rebuild the
original one, how can i get it?

P.S.: It's not homework, but i'd prefer just some help rather than the whole
sollution
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Rebuild jpg

2011-02-21 Thread Liam Clarke-Hutchinson
Hi Rafael,

Do you need to use Python 3.x? If you can use Python 2.6, the Python Imaging
Library is a great image manipulation module.
http://www.pythonware.com/products/pil/

Regards,

Liam Clarke

2011/2/21 Rafael Durán Castañeda 

> Hi all,
>
> I'm using Python 3.1 and I have an image of an animal that  has been broken
> it into many narrow vertical stripe images, and now i want to rebuild the
> original one, how can i get it?
>
> P.S.: It's not homework, but i'd prefer just some help rather than the
> whole sollution
>
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
>
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] creating classes while coding

2011-02-21 Thread Japhy Bartlett
I think OOP makes it easy for new programmers to set up programs, and
it can make for some pretty neat English looking code, but a more
functional approach generally makes for much leaner, faster performing
code.

I find them most useful when you have several functions that might
need to share some variables that the rest of the program doesn't care
about, especially if you might need to load that information at
run-time.

Just my two cents though, this is mostly a personal style thing, if
your code works. :)

- Japhy

On Sun, Feb 20, 2011 at 9:36 PM, Bill Allen  wrote:
> On Sun, Feb 20, 2011 at 19:59, Alan Gauld  wrote:
>>
>> "Bill Allen"  wrote
>>
>>> However, I do wonder a bit about the practice I have seen of some
>>> Python programmers to implement relatively short bits of code, that would
>>> be
>>> quite simple using functions and procedural code, with classes.
>>
>> OOP is often overkill, but if its the normal way of programming
>> - and for many recent students its all they get taught - then using
>> classes is the natural approach. "When all you have is a hammer
>> everything looks like a nail..." However, there may be good reasons.
>> Classes make reuse easier, in general, than functions. So if the
>> task may become a building block for a future project, or even
>> an extended version of the current one then building a class
>> makes sense.
>
> Thanks for the feedback.   Particularly when it comes to reuse of code, I
> can see it could be worth my time to look into designing classes a bit more.
>   I am starting to write enough code now that I am beginning to reuse some
> bits of it regularly.  I have not yet taken the reuse of code further than
> packaging up some functions into modules.  I'll look into this further.
>
> You mentioned the programming methods being taught programming students
> nowadays.   That OOP is a basic programming method being taught sure leaves
> me in the dust.   The last formal programming class I took in college was
> way back in the early 90s and it was to learn IBM 370 Assembly Language.
> OOP was not only not on the radar, it was not even in the same solar
> system!    :-D
>
> feeling kinda old, and I am not all that old...
>
> --Bill
>
>
>
>
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
>
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] creating classes while coding

2011-02-21 Thread Steven D'Aprano

Bill Allen wrote:

I know that Python not only supports OOP, but is fundamentally OOP in its
design.   Just in using the language and standard library, that much becomes
obvious.   However, I do wonder a bit about the practice I have seen of some
Python programmers to implement relatively short bits of code, that would be
quite simple using functions and procedural code, with classes.   Some such
code appears far more complicated than the job at hand really demands.   I
know there is not always a single right or wrong way of accomplishing
programming task, but why implement using classes unnecessarily?  When is it
necessary?  When is it best practice?  I'll freely admit that I do not come
from an OOP programming background, so designing classes is not my first
impulse when writing code.  Am I missing something?



No, I don't think you're missing anything. Too many people come from 
Java, where (virtually) everything *must* be a class. There's a 
wonderful essay about the "Kingdom of the Nouns":


http://steve-yegge.blogspot.com/2006/03/execution-in-kingdom-of-nouns.html

Don't get me wrong -- object oriented programming has much to say for 
it, but it's not the be-all and end-all of programming. Python makes it 
easy to mix imperative, object-oriented and functional programming 
idioms into the one program. (The only major idiom that Python doesn't 
support well is logic programming, as used by Prolog.)




--
Steven
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] creating classes while coding

2011-02-21 Thread Steven D'Aprano

Bill Allen wrote:

That raises my next question.   Under what sort of programming circumstances
does it make sense?


"It" being object oriented programming.

OO is good for encapsulation and code-reuse. One good sign you should 
consider a class is if you start building up many global variables. 
Instead of:



spam = 1
ham = 2
eggs = 3


def cook_spam():
pass

def slice_ham():
pass

def scramble_eggs():
pass


there may be something to say for putting those related functions into a 
class:



class Breakfast:
spam = 1
ham = 2
eggs = 3

def cook_spam(self):
pass

def slice_ham(self):
pass

def scramble_eggs(self):
pass



This then allows you to have two Breakfasts, each one of which could 
modify their own copies of spam, ham and eggs without effecting the other.




--
Steven
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Rebuild jpg

2011-02-21 Thread Rafael Durán Castañeda
I could use any python, so I'll try to solve using Image from 2.6, but what
about python 3.1?

El 21 de febrero de 2011 10:21, Liam Clarke-Hutchinson
escribió:

> Hi Rafael,
>
> Do you need to use Python 3.x? If you can use Python 2.6, the Python
> Imaging Library is a great image manipulation module.
> http://www.pythonware.com/products/pil/
>
> Regards,
>
> Liam Clarke
>
> 2011/2/21 Rafael Durán Castañeda 
>
>> Hi all,
>>
>> I'm using Python 3.1 and I have an image of an animal that  has been
>> broken it into many narrow vertical stripe images, and now i want to rebuild
>> the original one, how can i get it?
>>
>> P.S.: It's not homework, but i'd prefer just some help rather than the
>> whole sollution
>>
>> ___
>> Tutor maillist  -  Tutor@python.org
>> To unsubscribe or change subscription options:
>> http://mail.python.org/mailman/listinfo/tutor
>>
>>
>
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Rebuild jpg

2011-02-21 Thread Wayne Werner
2011/2/21 Rafael Durán Castañeda 

> I could use any python, so I'll try to solve using Image from 2.6, but what
> about python 3.1?
>

This post:
http://stackoverflow.com/questions/3896286/image-library-for-python-3 may be
of some use to you.

My guess is that you may need to use some type of clustering or
edge-detection algorithm - unless the strips are overlapping, in which case
it's easy ;)

Of course this also assumes that you want to do it automatically and not
manually tell the computer "this goes here and that goes there", but teach
it to solve the problem on its own.

I'm not terribly familiar with this problem domain, I just have some passing
knowledge because it's an interesting field to me.

HTH,
Wayne
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] PY-Tkinter Title Bar Icon

2011-02-21 Thread Ganesh Kumar
Hai..

I am new to python Tkinter..I want Title Bar Icon..

plz..Guide me to set up icon in Title Bar.

Advance Thanks

Thanks
-Ganesh.

-- 
Did I learn something today? If not, I wasted it.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] PY-Tkinter Title Bar Icon

2011-02-21 Thread Alan Gauld


"Ganesh Kumar"  wrote


I am new to python Tkinter..I want Title Bar Icon..
plz..Guide me to set up icon in Title Bar.


Last time I looked it was possible to do that 
under X Windows but not under MS Windows.

(I dont know about MacOS/Quartz)

It was a bug in the underlying Tk toolkit. 
But there has been a new release of Tk 
since then so it may be fixed...


Try experimenting with:

self.top.iconbitmap()
self.top.iconname()   
self.top.iconwindow() # and use an image Label...


You might get lucky...

HTH,

--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/






___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor