jagomart
digital resources
picture1_Python Gui Pdf 192083 | Computing


 132x       Filetype PDF       File size 0.04 MB       Source: archives.evergreen.edu


File: Python Gui Pdf 192083 | Computing
tkinter gui programming modeling motion week 6 computing homework do one of the following and submit it at thursday s computing lecture may 13 1 start create a tkinter gui ...

icon picture PDF Filetype PDF | Posted on 05 Feb 2023 | 2 years ago
Partial capture of text on file.
                                                  Tkinter GUI programming
                                          Modeling Motion Week 6 Computing Homework
                  Do one of the following and submit it at Thursday’s computing lecture May 13:
                 1) Start create a Tkinter GUI window for the computing part of your project with at least one widget.
                    Send the code whether it works or not. If it doesn’t include a description of what you’ve tried and
                    what you think might be wrong.
                 2) Do the following homework problem if you don’t plan to add a GUI element to your project program
                    or you want to try something more basic first.
                    Thefollowing program ) defines a class SineWave which draws a green sine wave with Visual Python.
                    SineWave also has a setAmplitude() method which will change the amplitude and redraw the wave.
                    Using the examples provided in class, try to create a class called Application which has an   init ()
                    method that creates a SineWave and a Scale widget which adjusts the amplitude of the SineWave
                    by calling its setAmplitude method. Allow adjustment from -4 to 4 in steps of .1. Use the Scale
                    widget’s set() method to set its initial value to an amplitude of 1.
                    ThenaddasecondScalewidgettoadjustthe frequency between 1 and 10 periods every 2π radians.
                    # Posted on the website at:
                    # http://academic.evergreen.edu/curricular/modelingmotion/ExampleCode/home.php#week7
                    from visual import *
                    class SineWave:
                         def    init (self):
                              self.amplitude = 1
                              self.frequency = 1
                              self.wave = curve(color=color.green, radius=.1)
                              self.draw()
                              #make axes
                              curve(pos=[(-2*pi,0),(2*pi,0)],radius=.1) # x-axis
                              curve(pos=[(0,-1),(0,1)],radius=.1)                 # y-axis
                         def setAmplitude(self,new amplitude):
                              self.amplitude = new amplitude
                              self.draw()
                         def draw(self):
                              points=[]
                              for x in arange(-2*pi,2*pi,pi/100):
                                   points.append( (x,self.amplitude*sin(self.frequency*x)) )
                              self.wave.pos=points
                    sine = SineWave()
                    sine.setAmplitude(2) # change the amplitude from the default of 1
                                                                       1
The words contained in this file might help you see if this file matches what you are looking for:

...Tkinter gui programming modeling motion week computing homework do one of the following and submit it at thursday s lecture may start create a window for part your project with least widget send code whether works or not if doesn t include description what you ve tried think might be wrong problem don plan to add element program want try something more basic rst thefollowing denes class sinewave which draws green sine wave visual python also has setamplitude method will change amplitude redraw using examples provided in called application an init that creates scale adjusts by calling its allow adjustment from steps use set initial value thenaddasecondscalewidgettoadjustthe frequency between periods every radians posted on website http academic evergreen edu curricular modelingmotion examplecode home php import def self curve color radius draw make axes pos x axis y new points arange pi append sin default...

no reviews yet
Please Login to review.