Python Programming: An Introduction to Computer Science, 3rd Ed.
Python Programming: An Introduction to Computer Science, 3rd Ed.
3rd Edition
ISBN: 9781590282755
Author: John Zelle
Publisher: Franklin, Beedle & Associates
bartleby

Concept explainers

bartleby

Videos

Question
Book Icon
Chapter 10, Problem 2PE
Program Plan Intro

Build GUI using Button class

Program Plan:

  • Import the required packages.
  • Declare a main function. Inside the main function,
    • Create the application window.
    • Create a button for Random Walk and Quit.
    • Call the method “activate()”.
    • Call the method “deactivate()”
    • Call the method “getMouse()” and store the value in variable “pt”.
    • Set the point using the method “Point()”.
    • Check whether the quit button is not clicked.
      • Call the method “deactivate()”.
      • Pass the parameters to the method “randWalk()”.
      • Call the method “activate()”, “deactivate()” and “getMouse()”.
      • Check the condition and call the method “getMouse()” and store the value in the variable “pt”.
      • Set the points using the method “Point()”.
      • Close the window.
    • Definition of method “randWalk()”.
      • Assign “point” to “loc2”.
      • Traverse the for loop until “i” reaches range “100”.
      • Get the position of “x” and “y”.
      • Call the method “Line()” by passing two parameter.
      • Call the method draw.
      • Assign “loc2” to “loc1”.
    • Definition of method “simOneStep()”.
    • Call the method random to determine he angle.
    • Determine the value of “x” and “y”.
    • Return the value of the point.
  • Call the main function.

Blurred answer
Students have asked these similar questions
do in any gui programming language Code the Start button to initialize the game. When Start is clicked you need to make the top label and the Start button invisible. You should also clear the contents of the Results label and make it visible, and make label 1 visible. Make the Guess button visible and make it the AcceptButton. Some of this might seem redundant but we want to use this procedure to allow the user to play again so we are programming it to restore all the start up conditions of the program. Create a Number It should have 1 variable: vNumber which has a normal property declaration. Instead of assigning value to the number variable type in the following code:Dim aRandom as new RandomvNumber = aRandom.Next(1,100)This creates a random number between 1 and 100 – the number the user will try to guess. Be sure to initialize this in the btnStart sub by assigning some value to it (theNumber.Number = 5). In the object create a subroutine called IsEqual with 2 parameters. The first…
you have to design a Club class and use it to create an application that simulates a soccer league tournament. You are not limited to the features included in these instructions, feel free to add any other components you find useful.
Modify the temperature conversion program so that it responds to the user’s press of the return or enter key. If the user presses this key when the insertion point is in a given field, the action which uses that field for input is triggered. Be sure to use the field names provided in the comments in your starter code. An example of the program is shown below: GUI Test 30 Celsius to Fahrenheit 68 Fahrenheit to Celsius Bind the Enter (Return) key to the celsiusField and the fahrField. When the Enter or Return key is pressed the GUI should convert the value of whichever field is in focus.   Temperature Converter GUI
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning
Time Complexity Analysis - How To Calculate Running Time | InterviewBit; Author: InterviewBit;https://www.youtube.com/watch?v=--oxG4Q1PA0;License: Standard YouTube License, CC-BY