A Beginner's Doubt

A

augustofec

Hello!
This is my first post in this group and the reason why I came across here is that, despite my complete lack of knowledge in the programming area, I received an order from my teacher to develop a visually interactive program, until 20th July, so we can participate in a kind of contest.

My goal is to learn and program it by myself, as good as the time allows me.. That said, what I seek here is advice from people who definitively have more experience than me on topics like: is it possible to develop this kind of program in such a short amount of time? What kinds of aspects of Python should I focus on learning? What tutorials and websites are out there that can help me? What kind of already done packages are out there that I can freely use, so I do not need to create all the aspects of the program froms scratch?

It would be wise to give an abstract of the program. I made an information flux kind of graphic, but I do not know how to post it in here, so I'll useonly words:

Full screen window -> Title and brief introductory text -> 3 Buttons (Credits) (Instructions) and (Start)

(Credits) -> Just plain text and a return button
(Instructions) -> Just plain text and a return button
(Start) -> Changes the screen so it displays a side-menu and a Canvas.

Side menu -> X number of buttons (maybe 4 or 5)
Buttons -> Clicked -> Submenu opens -> List of images
-> Return button -> Back to side menu

Image in List of images -> When clicked AND hold mouse button -> Make copy
-> if: dragged to canvas -> paste the copy in place
-> if: dragged anywhere else -> delete copy and nothing happens

On canvas:
Image -> On click and drag can be moved
-> Double click -> Opens menu -> Resize, Deform, Rotate, Color, Brigthness, Contrast, Color Curve, Saturation

Then, somewhere in cavas:

Save option -> Prompt for file and user's name
-> Prompt if users want printed copy or not -> Print
-> After saved, display random slideshow in other monitor, device or screen with the users' creations.

Thats basically the whole program. I've been studying Python for a week andhalf now, through: How to think like a Computer Scientist and Invent with Python and Pygame. I'm still at the very beggining, though, and I can't make much more than make some images appear on a Pygame screen in a menu-like style, with a patterned gap between them. No mouse interactions up to now.

I really appreciate your suggestions and help.
Thank you!
Augusto
 
N

Neil Cerutti

This is my first post in this group and the reason why I came
across here is that, despite my complete lack of knowledge in
the programming area, I received an order from my teacher to
develop a visually interactive program, until 20th July, so we
can participate in a kind of contest.

My goal is to learn and program it by myself, as good as the
time allows me.

That said, what I seek here is advice from people who
definitively have more experience than me on topics like: is it
possible to develop this kind of program in such a short amount
of time? What kinds of aspects of Python should I focus on
learning? What tutorials and websites are out there that can
help me? What kind of already done packages are out there that
I can freely use, so I do not need to create all the aspects of
the program froms scratch?

It would be wise to give an abstract of the program. I made an
information flux kind of graphic, but I do not know how to post
it in here, so I'll use only words:

Full screen window -> Title and brief introductory text -> 3 Buttons (Credits) (Instructions) and (Start)

(Credits) -> Just plain text and a return button
(Instructions) -> Just plain text and a return button
(Start) -> Changes the screen so it displays a side-menu and a Canvas.

Side menu -> X number of buttons (maybe 4 or 5)
Buttons -> Clicked -> Submenu opens -> List of images
-> Return button -> Back to side menu

Image in List of images -> When clicked AND hold mouse button -> Make copy
-> if: dragged to canvas -> paste the copy in place
-> if: dragged anywhere else -> delete copy and nothing happens

On canvas:
Image -> On click and drag can be moved
-> Double click -> Opens menu -> Resize, Deform, Rotate, Color, Brigthness, Contrast, Color Curve, Saturation

Then, somewhere in cavas:

Save option -> Prompt for file and user's name
-> Prompt if users want printed copy or not -> Print
-> After saved, display random slideshow in other monitor, device or screen with the users' creations.

Thats basically the whole program. I've been studying Python
for a week and half now, through: How to think like a Computer
Scientist and Invent with Python and Pygame. I'm still at the
very beggining, though, and I can't make much more than make
some images appear on a Pygame screen in a menu-like style,
with a patterned gap between them. No mouse interactions up to
now.

I really appreciate your suggestions and help.

First off, this is extremely ambitious for one month with no
programming experience. But it sounds like you've made some
significant progress. For a new programmer, mastering the
mechanical aspects of programming can be a huge hurdle, and
you've done that already.

Finally, my advice is to use tkinter combined with PIL for this
project, instead of PyGame. I have not personally used PyGame,
but my guess is it will be much harder to create a reasonable GUI
with PyGame than with tkinter. But I do not know how difficult
this project will be will be even using the libraries of least
resistance. The GUI you propose is very simple, except possibly
for the dragging and dropping, which I've not tried and might be
hairy. Moreover, I have not seriously used PIL and I don't even
know if it supports Python 3.
 
C

Chris Angelico

My goal is to learn and program it by myself, as good as the time allows me. That said, what I seek here is advice from people who definitively havemore experience than me on topics like: is it possible to develop this kind of program in such a short amount of time? What kinds of aspects of Python should I focus on learning? What tutorials and websites are out there that can help me? What kind of already done packages are out there that I can freely use, so I do not need to create all the aspects of the program fromsscratch?


One month to develop a program in Python? Absolutely possible, but you
WILL have your work cut out for you :)

You seem to have a fairly readable spec there. It'll be reasonably
straight-forward to turn that into code.

Spend some time writing other little tests, though. One way or
another, you will probably spend the next week writing code you throw
away; if you try to tackle the primary project immediately, you'll
have to rewrite parts of it as you learn. It's easier to throw away a
toy "Hello world" program than hunks of what you thought would be your
final code.

You may want to start with console programs, since they're ever so
much easier to write. But mainly, start writing. You have one month;
the best way to learn is to read stuff and pump stuff out. Make a
whole PILE of rubbishy code, watch what it does, learn from it. You'll
be amazed how much you can achieve in a week, much less a month. And
you'll love Python. :)

ChrisA
 
R

Rick Johnson

This is my first post in this group and the reason why I
came across here is that, despite my complete lack of
knowledge in the programming area, I received an order
from my teacher to develop a visually interactive program,

Ah teachers, you gotta love them! High on a power trip.
Drunk on tenure. Most of which are overpaid and
under-worked. Can't work with them, can't fire them!

"HAY, TEACH-AH! Leave them kids alone!"
until 20th July, so we can participate in a kind of
contest. My goal is to learn and program it by myself, as
good as the time allows me. That said, what I seek here is
advice from people who definitively have more experience
than me on topics like: is it possible to develop this
kind of program in such a short amount of time?

Develop what kind of program exactly? You see, usually you
want to explain the details of your problem *before* you ask
a question in relation to that problem, *ESPECIALLY* in the
case of a generic question! How do you expect us to provide
an answer? I mean, heck, even when faced with a post more
riddled with more expletives than a prostitute has STD's,
we can usually deduce the context of "it", however, in this
case your just plain obfuscating!

"What's the frequency Kenneth?"
What kinds of aspects of Python should I focus on
learning? What tutorials and websites are out there that
can help me? What kind of already done packages are out
there that I can freely use, so I do not need to create
all the aspects of the program froms scratch? It would be
wise to give an abstract of the program.

Yes, and wiser if you had given it at post.index[0]!

"Somethings happin' here" (at c.l.py)
"What it is ain't exactly clear"
"There's a post without context there!"
"Tellin' me, i got to beware!"
Full screen window -> Title and brief introductory text -> 3 Buttons (Credits) (Instructions) and (Start)
(Credits) -> Just plain text and a return button
(Instructions) -> Just plain text and a return button
(Start) -> Changes the screen so it displays a side-menu and a Canvas.
Side menu -> X number of buttons (maybe 4 or 5)
Buttons -> Clicked -> Submenu opens -> List of images
-> Return button -> Back to side menu
Image in List of images -> When clicked AND hold mouse button -> Make copy
-> if: dragged to canvas -> paste the copy in place
-> if: dragged anywhere else -> delete copy and nothing happens
On canvas:
Image -> On click and drag can be moved
-> Double click -> Opens menu -> Resize, Deform, Rotate, Color, Brigthness, Contrast, Color Curve, Saturation
Then, somewhere in cavas:
Save option -> Prompt for file and user's name
-> Prompt if users want printed copy or not -> Print
-> After saved, display random slideshow in other monitor, device or screen with the users' creations.

Easy. Pick up Tkinter and learn how to:

1. Display a window.

2. Display a button and associate a block of code to be
called when the button is pressed.

3. Learn how to create a menu and attach it to a topwindow.
Then add command and associate actions with those commands.

4. Display a canvas, then insert images in the canvas, then
manipulate them. Manipulation will require input from the
user, which involves either dialogs(easy) or interactive
modifications(difficult)

PS: What the hell is a "side menu"?
PPS: Good luck ;^)
 
C

Chris Angelico

Ah teachers, you gotta love them! High on a power trip.
Drunk on tenure. Most of which are overpaid and
under-worked. Can't work with them, can't fire them!

Just FYI, Augustof, Rick is one of our resident trolls. Don't take his
words to heart :) He knows his stuff when it comes to Tkinter though,
so you'll want to read his posts but ignore the emotion.

ChrisA
 
J

Joel Goldstick

wrote:

Ah teachers, you gotta love them! High on a power trip.
Drunk on tenure. Most of which are overpaid and
under-worked. Can't work with them, can't fire them!

"HAY, TEACH-AH! Leave them kids alone!"




What tutorials and websites are out there that

DO you have access to google?


What kind of already done packages are out
(Credits) (Instructions) and (Start)
Brigthness, Contrast, Color Curve, Saturation
device or screen with the users' creations.


THis looks like a description of a program that is already completed


This post seems so unlikely to me. What is the subject that this teacher
of yours teaches? Do you know anyone who has every done any programming?
Why python?

One of your problems is that you are being asked to pick a framework,
understand how to use it without having any basic knowledge of how to write
a computer program. I'm not a teacher, but personally this seems like a
really idiotic way to teach a student to learn how programming works.

I think that you should write a text on first term calculus in french, or
maybe in chinese. Its a similar problem. You need to learn your topic
(calculus, some unknown framework), and then you need to exercise your
topic in a foreign language.

Anyway, here's a book that might be useful: http://inventwithpython.com/

When (if) you get this done, come back and let us see your program
 
J

Joshua Landau

Please be aware, Augusto, that Rick is known to be a bit... OTT. Don't
take him too seriously (but he's not an idiot either).

Hello!
This is my first post in this group and the reason why I came across hereis that, despite my complete lack of knowledge in the programming area, I received an order from my teacher to develop a visually interactive program, until 20th July, so we can participate in a kind of contest.

My goal is to learn and program it by myself, as good as the time allows me. That said, what I seek here is advice from people who definitively havemore experience than me on topics like: is it possible to develop this kind of program in such a short amount of time?

Possible? Yes.
It'll be well'ard to get much done with too limited a knowledge base,
but it should be possible even then.
What kinds of aspects of Python should I focus on learning? What tutorials and websites are out there that can help me? What kind of already done packages are out there that I can freely use, so I do not need to create all the aspects of the program froms scratch?

Neil Cerutti suggested Tkinter. Choosing a good simple GUI toolkit is
a good idea over Pygame for something like this.
I've used Pygame and I guarantee you it's not the hammer you want.

(I don't know much about GUI's to be honest, though.)
It would be wise to give an abstract of the program. I made an information flux kind of graphic, but I do not know how to post it in here, so I'll use only words:
Thats basically the whole program. I've been studying Python for a week and half now, through: How to think like a Computer Scientist and Invent with Python and Pygame. I'm still at the very beggining, though, and I can't make much more than make some images appear on a Pygame screen in a menu-like style, with a patterned gap between them. No mouse interactions up to now..

In regards to this, I really would recommend just taking Rick's
suggestion: Tkinter; canvas; menu; etc.


Now, as I'm probably the most new programmer here I'll point out that
I don't agree with Chris when he says that:
One way or
another, you will probably spend the next week writing code you throw
away; if you try to tackle the primary project immediately, you'll
have to rewrite parts of it as you learn. It's easier to throw away a
toy "Hello world" program than hunks of what you thought would be your
final code.

As a new programmer, you will throw away code whether or not you
practice beforehand. Beware of that. If anything, it's the best thing
you can do*.

Other than that, he's spot on. Personally, I'd start on the big
project sooner rather than later, but not be afraid to dump all the
code every now and again.

*Anecdote time; a friend of mine who learned VB as his first language
wrote as one of his earlier scripts a 2075 line program with no
indentation - I still have a copy of that gem tucked away in a very
dark corner.


Last point; DRY. Look it up and breathe it. People might wonder why
I'm making that big a deal about it (it's not the be-all and end-all
of anything) but as a new programmer most of your random bits of
not-nice-looking code will probably just be a breach of DRY. If you've
written the same thing 5 times you've *probably* done it in a not-too
efficient manner and the real solution will be the next ladder up in
the hierarchy of programming.

As someone new, paying a fair bit of attention to this will probably
make what you learn some important higher-level concepts faster.


Best of luck, I hope I added something helpful.
 
C

Chris Angelico

Now, as I'm probably the most new programmer here I'll point out that
I don't agree with Chris when he says that:


As a new programmer, you will throw away code whether or not you
practice beforehand. Beware of that. If anything, it's the best thing
you can do*.

Yes, you will throw code away; but you'll throw away less of your
finished product if you write code that isn't destined to be part of
your finished product. But you're absolutely right; code should never
be treated like children, to be preserved at all costs. It's okay to
change your mind and scrap something.

ChrisA
 
R

rusi

Please be aware, Augusto, that Rick is known to be a bit... OTT. Don't
take him too seriously (but he's not an idiot either).




Possible? Yes.
It'll be well'ard to get much done with too limited a knowledge base,
but it should be possible even then.


Neil Cerutti suggested Tkinter. Choosing a good simple GUI toolkit is
a good idea over Pygame for something like this.
I've used Pygame and I guarantee you it's not the hammer you want.

(I don't know much about GUI's to be honest, though.)





In regards to this, I really would recommend just taking Rick's
suggestion: Tkinter; canvas; menu; etc.

Now, as I'm probably the most new programmer here I'll point out that
I don't agree with Chris when he says that:


As a new programmer, you will throw away code whether or not you
practice beforehand. Beware of that. If anything, it's the best thing
you can do*.

Speaking with the prejudice of teaching programming for 25 years :)
heres my take on this difference-of-opinion:

Imagine your program as a final finished product of say 2000 lines of
python.
So you have to log-up that 2000 lines one by one. Do you prefer to
use an adder or a multiplier?
If you only do 'add-1' youve to take two thousand steps, if you allow
mul-2 and mul-5 you can reach in 7.
Chris solution -- get good before you start your actual work --
amounts to the second, Joshua's -- just start! -- to the first.

Clearly the second is preferable right?? WRONG! You could get stuck in
a multiply-by-zero loop!
So you need the right combo of plodding along (Joshua) and self-
improvement (Chris).
 
T

Terry Reedy

Hello!
This is my first post in this group and the reason why I came across here is that, despite my complete lack of knowledge in the programming area, I received an order from my teacher to develop a visually interactive program, until 20th July, so we can participate in a kind of contest.

My goal is to learn and program it by myself, as good as the time allows me. That said, what I seek here is advice from people who definitively have more experience than me on topics like: is it possible to develop this kind of program in such a short amount of time? What kinds of aspects of Python should I focus on learning? What tutorials and websites are out there that can help me? What kind of already done packages are out there that I can freely use, so I do not need to create all the aspects of the program froms scratch?

It would be wise to give an abstract of the program. I made an information flux kind of graphic, but I do not know how to post it in here, so I'll use only words:

Full screen window

Do you literally mean a full screen *window*, like a browser maximized,
with frame and title bar with Minimize, Restore/Maximize, and Close
buttons? or a full-screen app without the frame, like full-screen games?

Tkinter, Wx, etc, are meant for the former, Pygame, etc, for the latter.

-> Title and brief introductory text -> 3 Buttons (Credits)
(Instructions) and (Start)
(Credits) -> Just plain text and a return button
(Instructions) -> Just plain text and a return button
(Start) -> Changes the screen so it displays a side-menu and a Canvas.

If you open Idle and click Help / About IDLE, you will see a dialog box
with title, text, and two groups of 3 buttons that open plain text,
including Credits, in a separate window with a close (return) button. It
you decide to use tkinter, this would give you a start. The code is in
Lib/idlelib/aboutDialog.py. I do not know how to make the 'dialog' be a
main window instead, nor how to replace a main window with a new set of
widgets (as opposed to opening a new window), but I presume its
possible. If so, I am sure Rick could tell us how.
Side menu -> X number of buttons (maybe 4 or 5)

Is this really required, as opposed to a normal top menu?
Buttons -> Clicked -> Submenu opens -> List of images
-> Return button -> Back to side menu

Image in List of images -> When clicked AND hold mouse button -> Make copy

I am not sure what you mean by 'copy'. Make an internal image object
from the disk file?
-> if: dragged to canvas -> paste the copy in place
-> if: dragged anywhere else -> delete copy and nothing happens

It sounds like the intention is to have multiple images on the canvas at
once.
On canvas:
Image -> On click and drag can be moved

This could be a problem if images overlap.
-> Double click -> Opens menu -> Resize, Deform, Rotate, Color, Brigthness, Contrast, Color Curve, Saturation

Image operations are what are usually placed on a size menu or floating
menu box.

Neil mentioned PIL (Python Image Library) because Tk's image support is
anemic, and does not have any built-in transformations. Pillow, at
https://pypi.python.org/pypi/Pillow/2.0.0
is a friendly fork that include patches to run on Python 3.3, which I
would otherwise recommend that you use.

Then, somewhere in cavas:

This should be a button on the side menu.
 
R

Rick Johnson

============================================================
Terry (speaking to OP) said:
============================================================
Do you literally mean a full screen *window*, like a
browser maximized, with frame and title bar with Minimize,
Restore/Maximize, and Close buttons? or a full-screen app
without the frame, like full-screen games? Tkinter, Wx,
etc, are meant for the former, Pygame, etc, for the
latter.

Actually Terry, a GUI window is a GUI window -- whether or
not the window displays "user window management controls" is
irrelevant. Consider this example using Tkinter:

## BEGIN SCRIPT ##
import Tkinter as tk

MSG = """\
Your Screwed: Muhahahaha!

Well, not really, you can destroy the window
since i provided a secret exit. But you cannot
maximize or minimize!!!

Muhahahahaha!

....Oh just get out of here already!"""

class App(tk.Tk):
def __init__(self):
tk.Tk.__init__(self)
self._createWidgets()

def _createWidgets(self):
_ = 'Create User Controllable Window'
w = tk.Button(self, text=_, command=self._cb1)
w.pack(padx=5, pady=5)
_ = 'Create User Pwned Window'
w = tk.Button(self, text=_, command=self._cb2)
w.pack(padx=5, pady=5)

def _cb1(self):
win = tk.Toplevel(self)
win.title('User Controllable')
win.geometry('500x500+20+20')
self.wait_window(win)

def _cb2(self):
win = tk.Toplevel(self)
win.overrideredirect(True)
win.geometry('500x500+20+20')
tk.Label(win, text=MSG).pack(fill=tk.X)
tk.Button(win, text='X', command=win.destroy).pack()

if __name__ == '__main__':
app = App()
app.mainloop()
## END SCRIPT ##
If you open Idle and click Help / About IDLE, you will see
a dialog box with title, text, and two groups of 3 buttons
that open plain text, including Credits, in a separate
window with a close (return) button.

I guess that depends on which version of Python you are
using. I don't have that dialog in my 2.7 version, although
i did confirm your advice is True for v3.2.2
It you decide to use tkinter, this would give you a start.
The code is in Lib/idlelib/aboutDialog.py. I do not know
how to make the 'dialog' be a main window instead, nor how
to replace a main window with a new set of widgets (as
opposed to opening a new window), but I presume its
possible. If so, I am sure Rick could tell us how.

Oh yes, Senior Rick has a virtual cornucopia of knowledge
locked away in his huge cranium just waiting for the
opportunity to propagate out into this dark and illogical
world. And Rick CAN tell you many things, the only question
is: will you listen?
I am not sure what you mean by 'copy'. Make an internal
image object from the disk file?

Sounds like he wants to allow the user to make some
"interactive manipulations" on canvas image objects. In this
particular case a "copy" operation.
This could be a problem if images overlap.

Not necessarily. You can "pick" the image that is currently
under the mouse pointer by querying certain tags,
reguardless of any "overlap".
Image operations are what are usually placed on a size
menu or floating menu box.

Unfortunately Tkinter does not provide interactive sizers
for canvas items. You can create one yourself fairly easily
however this is probably out of the range of a one month
project for a complete Python noob. But you don't even need
them really. Granted interactive manipulations are more
powerful in some situations, you could simply prompt the
user for values.

For sizing operations a percentage of width and height or
an absolute width and height values are all you need.

For Rotations a degree of rotation, and possibly a rotational
point(could default to centroid!) is all you need.

For color you could wield the tkColorChooser.

For Brightness you could either prompt for a value in range
MIN to MAX or use a Tkinter::Slider.

Simplistic deformations could also use a dialog.

My recommendation would be to forget about interactive
manipulations. First, get acquainted with the Tkinter
widgets, then start drawing things on canvas, then figure
out how to manipulate canvas items programically, then
prompt the user for manipulations values, and only then, and
only IF you still have time, try your hand at interactive
manipulations.

This is the path of a wise problem solver... THIS, is the
path of the Rick neophytes. Go forth my young disciples. Be
fruitful and multiply. The future of this gawd forsaken
planet depends on your success!

@OP: Here are two good resources for Tkinter learning:
http://infohost.nmt.edu/tcc/help/pubs/tkinter/web/canvas-methods.html
http://effbot.org/tkinterbook/
 
A

augustofec

Hello again!

Wow, I didn't expect so many responses in a so short amount of time! You guys are amazing! All were very helpful, and after a quick read now I guess I can at least figure out a more focused path to achieve my goal.

I'm already checking the Tkinter tutorial, and as soon as I get a result I'll post it here to give a response :).

Yes, I forgot to mention some things: I have absolutely no knowledge about programming due to the fact that I'm a Visual Arts student, being my professor, accordingly, a Photography teacher with absolutely no idea of this field! He has, however, these kinds of 'multi-platform' projects, and since I was the fortunate student next to him when he came up with the idea, I got dragged into it.

The reason why I choose Python is that, once ago, I had some curiosity about 3D Modelling and game programming, which made me come across some texts praisng Python as an easy to learn and powerful language (despite the own concepts of an "easy" and "powerful" language being something quite vague forme :p).

That said, I would also like to apology for eventual typos and grammar errors since english is not my first language. By "side menu" I just imagined amenu in the left side of the screen, pretty much like the one in the Google groups page.

And by copying the image from the menu to the canvas, when dragging it, I imagined a way to just place it, like a stamp, on the blank area where the user can in fact interact with it trought the editing tools (resize, rotate,color etc..).

Well, once again I thank you all and by now I'm gonna study!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,153
Members
46,701
Latest member
XavierQ83

Latest Threads

Top