[Tutor] Bitmap editor and File-saving

2007-11-10 Thread Johnston Jiaa
Hello, I already asked this on python-list, but would like to improve  
the odds of having my question answered, so I am asking it here too.   
I apologize if this bothers anyone.

I am using Tkinter to create a program in which the user can draw a  
simple bitmap image.  What library would be best to use in this  
circumstance?  I have no idea how I would go about doing this except  
maybe I would use Tkinter's canvas component?

In order for the program to be useful, it should save the picture  
too.  I'd like for it to save the image with some strings of text.   
How can I implement such a file-saving feature?  Would pickling  
work?  I have no idea how to accomplish this task efficiently.

Thanks in advance,
Johnston
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Tkinter Canvas Widget

2007-11-12 Thread Johnston Jiaa
I'm trying to create a free-hand drawing area on my program using the  
Tkinter canvas widget.  I have read through all the methods on Canvas  
objects <http://infohost.nmt.edu/tcc/help/pubs/tkinter/canvas- 
methods.html>, but do not see how to get the coordinates of the mouse  
on the canvas.

Also, after I get those coordinates, which methods would be  
appropriate to draw the points onto the canvas itself?

I appreciate any pointers or links to resources or anything at all.

Johnston Jiaa
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Tkinter Grid Layout Problems

2007-11-25 Thread Johnston Jiaa
I'm trying to get the left part of a window to look like this:
http://img.photobucket.com/albums/v228/gaypig123ABC/PB240055.jpg

I tried using sticky's, but nothing seems to work correctly.

This is my attempt, without the sticky's..
 self.lt_lbl = Label(frame, text="Left label")
 self.lt_lbl.grid(row=0, column=0)

 self.lt_add_btn = Button(frame, text="Left add button")
 self.lt_add_btn.grid(row=0, column=1)
 self.lt_rem_btn = Button(frame, text="Left remove button")
 self.lt_rem_btn.grid(row=0, column=2)

 self.lt_lstbx = Listbox(frame)
 self.lt_lstbx.grid(row=1, column=0)
 self.lt_scrlbr = Scrollbar(frame)
 self.lt_scrlbr.grid(row=1, column=1)

How do I get everything aligned properly?


Thanks,
Johnston Jiaa
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Grid Manager Positioning

2007-11-28 Thread Johnston Jiaa
How do I get widgets to be on the extreme left and right sides of a  
frame using the grid manager?  My code is similar to this..

big_frame = Frame(root)
big_frame.grid(sticky=W+E)

left_frame = Frame(big_frame)
left_frame.grid(row=0, column=0, sticky=W)

right_frame = Frame(big_frame)
right_frame.grid(row=0, column=1, sticky=E)

Supposing the root window is wider than the left and right frames put  
together, why doesn't left_frame go all the way to the left and  
right_frame all the way to the right with a space between them?  How  
do I make it do that?


Johnston Jiaa
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Grid Manager Positioning

2007-11-29 Thread Johnston Jiaa
>
> Presumably because big_frame is narrower than root.
> The inner frames will only go as far as the border of big_frame.

Well, with my code, I made bg="blue" so I see that it's big enough,  
and the big_frame stretches to fit inside root if i use sticky=W+E.


> Use pack(side= expand="true" ) ;-)

I heard that it's not good to mix grid and pack positioning?  And I  
already wrote it in grid.


Johnston Jiaa
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Button 1 Motion Event

2007-12-04 Thread Johnston Jiaa
I'm creating a drawing program, like MS Paint in Tkinter.  I bound  
the  event to my Canvas object.  The function it's bound  
to creates an oval at the event's x and y attributes.

This works fine if the user is dragging slowly, but if he does a  
sudden dragging motion, the ovals are very far apart.  Is there any  
way to fix this?

Johnston Jiaa
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Tkinter Canvas Saving and Opening

2007-12-04 Thread Johnston Jiaa
I know that Tkinter's canvas can output its contents into a  
postscript file, but can that file be used in turn to restore the  
image?  How can I implement this file-saving and opening feature?
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Program for outputing the letter backward

2006-03-28 Thread Johnston Jiaa
Hoffman,I am a newbie at python and programming in general so excuse me if I'm wrong.  In your example, you hadwhile index >= index_zero:which I believe to not be what you intended as you are essentially saying:while "last letter of vehicle" >= "first letter of vehicle""e" is respectively "less than" "v", so that is why your code never executes.  You probably mean for the index to actually be the index, not the last letter.  "index -= 1" is illegal as the variable points to a string, which can not be subtracted from.  Hope I was of help!Johnston Jiaa ([EMAIL PROTECTED])
		New Yahoo! Messenger with Voice. Call regular phones from your PC and save big.___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Apple Remote "Mouse"

2006-03-30 Thread Johnston Jiaa
I recently bought a Macbook Pro from Apple.  As it comes with a remote, I thought it would be great to use it as a mouse when not in Front Row.  The fast forward button would move the cursor to the left, the volume increase would move it up the screen, etc and the play button would serve as a "click."Is there any way to manipulate the cursor position on the screen using Python?  It is greatly appreciated if someone can point in the direction of where to look or what to search as no immediately useful hits came up from google.I am absolutely clueless about how to implement any of this.  It would be awesome if someone could briefly explain, or maybe point me to a tutorial of any sort, how to write a program that could detect the button pressed on the remote and accordingly move the cursor up, down, side-to-side.  Knowing how to disable the volume control of the "up and down" function of the anticipated remote would also be great, if
 anyone has time to elaborate how this can be done.Thank you for reading my message, and I hope you do not regard me as being a waste of your time.Johnston Jiaa ([EMAIL PROTECTED])
		Blab-away for as little as 1¢/min. Make  PC-to-Phone Calls using Yahoo! Messenger with Voice.___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Apple Remote "Mouse"

2006-04-01 Thread Johnston Jiaa
Hey Alan,I'm fairly new to programming and this is my first Apple computer.  It arrives on Monday, I've been waiting for ages.  Amazon took forever shipping it out.  Anyway, this will ultimately be a true learning experience -- I'll tell you how it turns out!  Many thanks for giving me these pointers, I'll check out all the sites and be immersed in all these Apple pages the next couple of weeks or so.Johnston Jiaa ([EMAIL PROTECTED])
		Blab-away for as little as 1¢/min. Make  PC-to-Phone Calls using Yahoo! Messenger with Voice.___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] first programming project

2006-08-18 Thread Johnston Jiaa
I have read through many beginner texts on programming
and believe myself to be fairly decent at python, but
I have no idea how to do anything worthwhile.  I
understand that before coding a project it's best to
design it and write some pseudocode first.  I want to
create a fun GUI assignment manager.  I read about the
Tkinter toolkit and would like to use it to write my
program.  I made a list of features:

- root window will be split into three sections: 
categories, assignments, and an animated creature that
responds to actions

- assignments will have three attributes:  priority,
points (grade points for completeness and creative
points for how interestingly assignment was done),
dates (assigned, completed)
- sub-assignments can be added to assignments to break
it up into steps
- each assignment will fit into a marking period
category with two averages (grade average and creative
average)
- grade average is the percentage found by dividing
points earned by total possible points

- creature will have two statuses (hunger status, mood
status)
- hunger status effected by grade points and averages
- mood status effected by creative points and averages
- each time assignment completed, food appears in
creature section and user may feed it or store it in a
bin (food more nourishing for higher-point
assignments)
- increments of creative points (maybe for every 10?)
add mini-games to play with creature

That's the general idea of my program.  I have never
written a real program before, am I missing any steps?
 Is there something I am missing from having this be a
complete program?  Any help at all is greatly
appreciated.

Johnston Jiaa

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Tkinter GUI Grid Layout Manager

2006-09-21 Thread Johnston Jiaa
I am trying to get 3 buttons, equally separated along the top of the window.  How do I get them to all be the same size and how do I make them so that they are equidistant to each other?Along with those three buttons, I am trying to get a text box, near the middle of the window.  Every time I attempt to put this in, it messes up the position of the top buttons.  My code follows:    # Top "Mode" Widgets    # Settings Button    self.settings_bttn = Button(self, text = "Settings")    self.settings_bttn.grid(row = 0, column = 2, columnspan = 2, sticky = EW)    # Statistics Button    self.stats_bttn = Button(self, text = "Statistics")    self.stats_bttn.grid(row = 0, column = 5, columnspan = 2, sticky = EW)    # Procrastinate Button    self.proc_bttn = Button(self, text =
 "Procrastinate")    self.proc_bttn.grid(row = 0, column = 8, columnspan = 2, sticky = EW)    # Top-Mid Separator    self.top_mid_sep_lbl = Label(self, text = "--")    self.top_mid_sep_lbl.grid(row = 1, column = 0, columnspan = 10, sticky = EW)    # Mid Assignments Widgets    # Assignments Text Display    self.assign_disp_txt = Text(self, width = 30, height = 18, wrap = WORD)    self.assign_disp_txt.grid(row =3, column = 1, columnspan = 5, sticky = W)Thanks, Johnston Jiaa 
		Do you Yahoo!? Everyone is raving about the  all-new Yahoo! Mail.___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor