This time we'll practice using of timers, textbuffers, adjustments, file dialogs, and scrollbars.
The task in question (especially shown) may appear elaborous, but each part of it is actually quite straightforward if we divide the task to small enough methods. Thus, plan carefully your solution in advance. After all your work, if your version still has some some missing features, mention the implemented and missing functionality in self-evaluation, and submit anyway. Perfect versions will get perfect points, mostly working versions still enough points.
Take a skeleton from the web-page. There are other exampless too. Also, you can find a compiled example, but it has some bugs (made on purpose).
Make your solution a single Python source file.
The answers to X-exercises have to be unique for every student. Not even partial copies of the same answer are allowed. The answer has to be sent via email by Thursday 2:00 pm (the previous day) according to the instructions below. You will receive an acknowledgment upon successful processing within few minutes. Answers will be graded. The answer must also contain a short self-evaluation in which you describe whether the program works, has some problems (tell which), or does not probably work; how good structure is has, what could be improved, etc. The self-evaluation must be stored as a comment within the program. A correct and proper self-evaluation is worth one point (in case of a proper answer).
Send your answer to using cs to user sjuva with a subject GUI_X3_username (case-sensitive, with underscores, username is your username), and the answer (with self-evaluation) as the body of the message (no attachments). Most reliably using program mail at cs:
/usr/ucb/mail -s GUI_X3_username sjuva < yourcode.py
where username is your cs username and yourcode.py is the single source file containing your answer. As Python is very strict on whitespaces, I strongly suspect that WebMail, Gmail, pine, etc. will fail on keeping the code intact. I'm not going to fix a messed intendation by hand.
Notice also that Python is interpreted language, thus the receiving system can only detect syntactical errors (such as indentation), but not semantical errors (such as type incompatibilities).
Other than cs.joensuu.fi users got separate instructions with X1, continue with them.
Make a text file reading tool that can scroll automatically.
The user can open any text file using a file chooser. The text file contents is displayed in the middle of the window within a text view. Text view has vertical scrollbars for showing long texts. Horisontally, lines are wrapped. At the bottom of window, there is a slider that adjusts automatic scrolling speed. If the user adjusts the speed slider to non-zero position, the text view starts scrolling smoohtly forward along the text file. The speed of scrolling depends on the setting of speed slider.
The File-menu has selections to Open a new file, Close the exiting file, and Quit the whole program.
As a final touch, you should consider also following details: Close is active only when there is a file; it there is no scrolling, the program should be idle; scrolling should stop at the end of text (showing last page).
Hints:
The basic X3 describe above could only show a file at a time. Enchance the functionality to allow having several open files simultaneously. The files are shown in separate pages (tabs) of a Notebook. File-Open creates a new page with new content, and File-Close closes the current one.
Further, make Space-key to toggle pause/resume scrolling (keeping the speed the user has chosen).
Hints:
At exercise class, we also discuss the following questions:
Last modified Fri Nov 16 08:44:12 EET 2007 SJ