Question

Python 3 I am trying to get my GUI Celsius to Fahrenheit calculator to work, why...

Python 3

I am trying to get my GUI Celsius to Fahrenheit calculator to work, why won't this run? let me know what to change specifically

import tkinter
import tkinter.messagebox

class GUI:
    def __int__(self):

        self.main_window=tkinter.Tk()

        self.frame1=tkinter.Frame(self.main_window)
        self.frame2=tkinter.Frame(self.main_window)
        self.frame3=tkinter.Frame(self.main_window)

        self.label1=tkinter.Label(self.frame1,text="Enter Celsius value: ")

        self.entry1=tkinter.Entry(self.frame1,width=10)

        self.label1.pack(side='left')

        self.entry1.pack(side='left')

        self.far=tkinter.StringVar()

        self.res=tkinter.Label(self.frame2,text='The Fahrenheit value is:')

        self.result=tkinter.Label(self.frame2,textvariable= self.far)

        self.res.pack(side='left')
        self.result.pack(side='left')

        self.calc=tkinter.Button(self.frame3,text='Calculate Fahrenheit',command=self.calfahr)

        self.quit_button=tkinter.Button(self.frame3,text='Quit',command=self.main_window.destroy)

        self.calc.pack(side='left')

        self.quit_button.pack(side='left')

        self.frame1.pack()
        self.frame2.pack()
        self.frame3.pack()

        tkinter.mainloop()

    def calfahr(self):
        self.test1=float(self.entry1.get())
        self.thisanswer=float((1.8*(self.test1))+32)

        self.far.set(self.thisanswer)
        
g=GUI()
0 0
Add a comment Improve this question Transcribed image text
Request Professional Answer

Request Answer!

We need at least 10 more requests to produce the answer.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the answer will be notified once they are available.
Know the answer?
Add Answer to:
Python 3 I am trying to get my GUI Celsius to Fahrenheit calculator to work, why...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
  • The Gui has all the right buttons, but from there i get lost. I need to...

    The Gui has all the right buttons, but from there i get lost. I need to know whats wrong with my assignment can someone please help. The code I have so far is listed below, could you please show me the errors in my code. PYTHON Create the GUI(Graphical User Interface). Use tkinter to produce a form that looks much like the following. It should have these widgets. Temperature Converter GUI Enter a temperature (Entry box)                 Convert to Fahrenheit...

  • Help with Python code. Right now I'm creating a code in Python to create a GUI....

    Help with Python code. Right now I'm creating a code in Python to create a GUI. Here's my code: #All modules are built into Python so there is no need for any installation import tkinter from tkinter import Label from tkinter import Entry def calculatewages(): hours=float(nhours.get()) nsal=float(nwage.get()) wage=nsal*hours labelresult=Label(myGUI,text="Weekly Pay: $ %.2f" % wage).grid(row=7,column=2) return Tk = tkinter.Tk()    myGUI=Tk myGUI.geometry('400x200+100+200') myGUI.title('Pay Calculator') nwage=float() nhours=float() label1=Label(myGUI,text='Enter the number of hours worked for the week').grid(row=1, column=0) label2=Label(myGUI,text='Enter the pay rate').grid(row=2, column=0)...

  • Im posting a python program and need to convert it to C++ language. import Tkinter import...

    Im posting a python program and need to convert it to C++ language. import Tkinter import Tkinter as tk from Tkinter import * import time def current_iso8601():     """Get current date and time in ISO8601"""     # https://en.wikipedia.org/wiki/ISO_8601     # https://xkcd.com/1179/     return time.strftime("%m.%d.%Y DATE %H:%M:%S TIME") class Application(tk.Frame):     def __init__(self, master=None):                 tk.Frame.__init__(self, master)         self.pack()         self.createWidgets()         def tstampIn(self):                 clockFile = open("clockTracker.txt","w")         print "You have successfuly Clocked In \n"         clockIn...

  • I want to make a really simple maze game in Python. I need to use tkinter and GUI to make this ha...

    I want to make a really simple maze game in Python. I need to use tkinter and GUI to make this happened. Under you can see the description of the task, but i need help to getting startet. If there is an other easier way I'm just happy for the help!! task Description: You have to create a maze game. The goal of the game is to get out of the maze. The game should read The maze from a...

  • I am trying to create tkinter GUI for guess a number game.I am not able to...

    I am trying to create tkinter GUI for guess a number game.I am not able to complete it .Could someone guide me to complete.I am so confused about using tkinter in while loop . Below code is not working correctly .Could someone please help with this ? def get_binary_digits(dividend): binary_digits = [] while dividend != 0: quot = dividend // 2 remainder = dividend % 2 binary_digits.append(remainder) dividend = quot # The quotient becomes the new dividend. binary_digits.reverse() return binary_digits...

  • Question: I am unable to get a output of my function on my label1 when I...

    Question: I am unable to get a output of my function on my label1 when I click on button 1, please help? - x Lè DRAFT P1.py - C:\Users\Darren Louw\Desktop\DRAFT P1.py (3.8.2)* File Edit Format Run Options Window Help from tkinter import* HEIGHT=300 WIDTH=400 root=Tk) lowerframe=Frame (root, bg='green', bd=10) lowerframe.place (relx=0.5, rely=0.6, relwidth=0.75, relheight=0.2, anchor='n') labell-Label (lowerframe, bg='white', font=30) labell.place (relwidth=0.25, relheight=0.8, relx=0) def countl(): countl=0 for i in range (1,1001): num= i*i if num>1000: countl=countlul print('numbers in range 1...

  • In python, PART A: I am trying to get a dictionary with size(4, 5, 6) as...

    In python, PART A: I am trying to get a dictionary with size(4, 5, 6) as keys and an array for key containing a list of values (words from file of respective size) associated with those keys I am reading from a file of strings, where I am only interested with words of length 4, 5, and 6 to compute my program reading the text file line by line: At first, I have an empty dictionary then to that I...

  • I need trying to figure out how I can make create a code in Python with this exercise for I am having trouble doing so. Miles Per Gallon Calculator Write a GUI program that calculates a car's gas...

    I need trying to figure out how I can make create a code in Python with this exercise for I am having trouble doing so. Miles Per Gallon Calculator Write a GUI program that calculates a car's gas mileage. The program's window should have Entry widgets that let the user enter the number of gallons of gas the car holds, and the number of miles it can be driven on a full tank. When a Calculate MPG button is clicked,...

  • PHP Can't get my code to work, what am I doing wrong? <!DOCTYPE html> <html> <head>...

    PHP Can't get my code to work, what am I doing wrong? <!DOCTYPE html> <html> <head> <script> </script> </head> <body> <h2>Temperature Conversion Table</h2> <h4>Enter a starting value in degrees Fahrenheit and an increment value.</h4> <form name="myTemp" onsubmit="convertCelcius()" method="post"> <input type="text" name="temperature"> Enter an value in degrees Fahrenheit<br><br> <input type="radio" name="degIncrement" id="degIncrement5"> Convert in increment in 5 degrees<br> <input type="radio" name="degIncrement" id="degIncrement10"> Convert in increment in 10 degrees <br/><br/><input type="submit" value="Submit"> </form> <?php if( $_POST["temperature"] || $_POST["degincrement"] ) { //get he...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT