Create the dialog shown in Figure 6.11. It should have the class name Re-sizeDlg, and its initializer should accept an initial width and height. The dialog should provide a method called result(), which must return a two-tuple of the width and height the user has chosen. The spinboxes should have a minimum of 4 and a maximum of four times the width (or height) passed in. Both should show their contents right-aligned.
Modify the Image Changer application so that it has a new "edit resize" action. The action should appear on the Edit menu (after the "edit zoom" action). An icon called editresize.png is in the images subdirectory, but will need to be added to the resources.qrc file. You will also need to import the resize dialog you have just created.
The resize dialog should be used in an editResize() slot that the "edit resize" action should be connected to. The dialog is used like this:
form = resizedlg.ResizeDlg(self.image.width(), self.image.height(), self)
width, height = form.result()
Unlike the editZoom() slot, the image itself should be changed, so the size label, status bar, and dirty status must all be changed if the size is changed. On the other hand, if the "new" size is the same as the original size, no resizing should take place.
The resize dialog can be written in less than 50 lines, and the resize slot in less than 20 lines, with the new action just requiring an extra one or two lines in a couple of places in the main window's initializer.
A model solution is in the files chap06/imagechanger_ans.pyw and chap06/resize-dlg.py.
This page intentionally left blank
• Designing User Interfaces
• Implementing Dialogs
• Testing Dialogs
Was this article helpful?
The main focus of this report is to show how to get involved in video marketing on the run, how to rank quickly on YouTube and Google using FREE semi-automatic tools and services. QUICKLY AND FREE. I will show methods and techniques I use to rank my videos, as well as free resources and tools to make video clips, to get backlinks and free traffic.