[Tutor] creating a text widget

ALAN GAULD alan.gauld at btinternet.com
Fri Jan 14 01:29:43 CET 2011


Forwarding to list...

 

> none of it actually.  i am brand new to Tk/Python.  Actually, i don't have a 
>need to do any editing on the file.

OK, display is pretty easy. Take a look in my tutorial under Event Driven 
Programming. 

There you will see a simple text widget with text being inserted. Or look in the 
Case Study 

topic for a more extensive GUI with more text being inserted into a text widget.


But perhaps you should try first to write a program that simply pages 
data from your file onto the screen using print() - perhaps limited to 
25 lines at a time? Hitting space should bring up the next 25 lines, 
and so on.

That will give you experience of working with files.

HTH,

Alan Gauld
Author of the Learn To Program website
http://www.alan-g.me.uk/




________________________________
From: Alan Gauld <alan.gauld at btinternet.com>
To: tutor at python.org
Sent: Thu, January 13, 2011 1:35:08 PM
Subject: Re: [Tutor] creating a text widget


"W S" <wynnstinson at rocketmail.com> wrote 
> could someone please provide me some code that would create a text widget that 
>i could open a text file in?  
>

You don;t open the text file in the widget as such, you open the file in Python 
as usual and copy its contents into the text widget.

When you are done making changes (if you are making changes) then you have to 
copy the content back out to the file (or rename the original to .bak and create 
a new version)

So the question is which part do you not understand?
- Creating a text widget
- opening the file
- copying the file to the widget
- copying changes to the file

HTH,

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


_______________________________________________
Tutor maillist  -  Tutor at python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110114/5bec34fb/attachment.html>


More information about the Tutor mailing list