Graphical representation of the field
On the previous pages you developed classes to represent crops and animals graphically. We also need a graphically representation of the field. The object diagram shows what is required:
As you can see from the diagram, the same composition approach used for the crops and animals is required for the field.
The video below demonstrates this.
Use the above video to create the class required to represent the field graphically.
Now that we have classes that we can use to represent the crops, animals and the field it is time to think about the main window. The diagram below shows its structure:
When constructing the main window it is important that you stick to the attribute names given in the above class diagram as these names will be used in the following sections. If you prefer, you can follow a video which demonstrates how to create the main window.
Focus on the graphics view and the push buttons, we will look at the toolbar in the next section.
Use the above video to create the field simulation main window.
- 1. Installing PyQt on Mac OS X
- 2. Installing PyQt on Windows
- 3. Introduction to PyQt
- 4. Graphical crop simulation
- 5. Creating a basic PyQt application
- 6. Introduction to Layouts
- 7. Radio Button Widget
- 8. Creating the layouts
- 9. Switching layouts
- 10. Adding growth functionality
- 11. Graphics and resources
- 12. Summary
- 13. Field simulation
- 14. Designing the user interface
- 15. Graphical representation of crops and animals
- 16. Resources file
- 17. Crop and animal graphical sub-classes
- 18. Graphical representation of the field
- 19. Toolbars
- 20. Introduction to event handling
- 21. Adding the drag functionality to the toolbar labels
- 22. Adding the 'drop' functionality to the field
- 23. Context Menus
- 24. Automatically growing the field
- 25. Manually growing the field
- 26. Field Report
- 27. Final Summary
- 28. Distributing your application
- 29. Distributing your application on Mac OS X
- 30. Distributing your application on Windows