“онлайн компилятор Python для графического интерфейса” Ответ

онлайн компилятор Python для графического интерфейса

from tkinter import *
def calculate():
    temp = int(entry.get()) 
    temp = 9/5*temp+32
    output_label.configure(text = 'Converted: {:.1f}'.format(temp))
    entry.delete(0,END)

root = Tk()
message_label = Label(text='Enter a temperature', font=('Verdana', 16))
output_label = Label(font=('Verdana', 16))
entry = Entry(font=('Verdana', 16), width=4)
calc_button = Button(text='Ok', font=('Verdana', 16), command=calculate)
message_label.grid(row=0, column=0) 
entry.grid(row=0, column=1)
calc_button.grid(row=0, column=2) 
output_label.grid(row=1, column=0, columnspan=3)
mainloop()
Precious Puma

онлайн компилятор Python для графического интерфейса

from tkinter import *

app = Tk()
app.title("Unit Converter")
scales = ["Meters","Inches","Foot"]

_from = StringVar()
from_menu = OptionMenu(app, _from, *scales)
from_menu.grid(row=0,colomn=0,pady=5)

lbl = Label(app,text = 'Convert to')
lbl.grid(row=0,colomn=1,pady=5)

to_ =StringVar()
to_menu = OptionMenu(app,to_,*scales)
to_menu.grid(row=0,colomn=2,pady=5)

enterLabel = Label(app,text='Enter your length')
enterLabel.grid(row=1,colomn=0,colomnspan=2,pady=5)

num1 = Entry(app)
num1.grid(row=1,colomn=2,colomnspan=2,pady=5)

def converter():
    user_input_type = _from.get()
    convert_type = to_.get()
    user_input_number = num1.get()

    if user_input_type == 'Meters' and convert_type == 'Inches':
        converted_value = user_input_number * 39.37
    elif user_input_type == 'Meters' and convert_type == 'Foot':
        converted_value = user_input_number * 3.28
    elif user_input_type == 'Inches' and convert_type == 'Meters':
        converted_value = user_input_number / 39.37
    elif user_input_type == 'Foot' and convert_type == 'Inches':
        converted_value = user_input_number * 12
    elif user_input_type == 'Inches' and convert_type == 'Foot':
        converted_value = user_input_number / 12
    elif user_input_type == 'Foot' and convert_type == 'Meters':
        converted_value = user_input_number / 3.28
    else:
        converted_value = user_input_number

    output_number_label = Label(app,text = round(converted_value,2),width=10)
    output_number_label.grid(row=1,colomn=4,pady=5)


conversion_button = Button(app,text='convert',command='onverter')
conversion_button.grid(row='2',colomn='0',pady='5')

app.mainloop()







Zealous Zebra

онлайн компилятор Python для графического интерфейса

import turtle 

turtle.speed(3)
turtle.bgcolor('black')
turtle.pensize(3)
def func():
    for i in range(200):
        turtle.right(1)
        turtle.forward(1)
turtle.color('red' , 'pink')
turtle.begin_fill()
turtle.left(140)
turtle.forward(111.65)
func()
turtle.left(120)
func()
turtle.forward(111.65)
turtle.end_fill()
turtle.hideturtle()
turtle.done()
Deepu Amar

онлайн компилятор Python для графического интерфейса

from tkinter import *

app = Tk()
app.title("Unit Converter")
scales = ["Meters","Inches","Foot"]

_from = StringVar()
from_menu = OptionMenu(app, _from, *scales)
from_menu.grid(row=0,colomn=0,pady=5)

lbl = Label(app,text = 'Convert to')
lbl.grid(row=0,colomn=1,pady=5)

to_ =StringVar()
to_menu = OptionMenu(app,to_,*scales)
to_menu.grid(row=0,colomn=2,pady=5)

enterLabel = Label(app,text='Enter your length')
enterLabel.grid(row=1,colomn=0,colomnspan=2,pady=5)

num1 = Entry(app)
num1.grid(row=1,colomn=2,colomnspan=2,pady=5)

## 1 Meter = 39.37 Inches
## 1 Meter = 3.28 Inches
## 1 Foot = 12 Inches

def converter():
    user_input_type = _from.get()
    convert_type = to_.get()
    user_input_number = num1.get()

    if user_input_type == 'Meters' and convert_type == 'Inches':
        converted_value = user_input_number * 39.37
    elif user_input_type == 'Meters' and convert_type == 'Foot':
        converted_value = user_input_number * 3.28
    elif user_input_type == 'Inches' and convert_type == 'Meters':
        converted_value = user_input_number / 39.37
    elif user_input_type == 'Foot' and convert_type == 'Inches':
        converted_value = user_input_number * 12
    elif user_input_type == 'Inches' and convert_type == 'Foot':
        converted_value = user_input_number / 12
    elif user_input_type == 'Foot' and convert_type == 'Meters':
        converted_value = user_input_number / 3.28
    else:
        converted_value = user_input_number

    output_number_label = Label(app,text = round(converted_value,2),width=10)
    output_number_label.grid(row=1,colomn=4,pady=5)


conversion_button = Button(app,text='convert',command='onverter')
conversion_button.grid(row='2',colomn='0',pady='5')

app.mainloop()







Zealous Zebra

онлайн компилятор Python для графического интерфейса

from tkinter import *

app = Tk()
app.title("Unit Converter")
scales = ["Meters","Inches","Foot"]

_from = StringVar()
from_menu = OptionMenu(app, _from, *scales)
from_menu.grid(row=0,colomn=0,pady=5)

lbl = Label(app,text = 'Convert to')
lbl.grid(row=0,colomn=1,pady=5)

to_ =StringVar()
to_menu = OptionMenu(app,to_,*scales)
to_menu.grid(row=0,colomn=2,pady=5)

enterLabel = Label(app,text='Enter your length')
enterLabel.grid(row=1,colomn=0,colomnspan=2,pady=5)

num1 = Entry(app)
num1.grid(row=1,colomn=2,colomnspan=2,pady=5)

## 1 Meter = 39.37 Inches
## 1 Meter = 3.28 Inches
## 1 Foot = 12 Inches

def converter():
    user_input_type = _from.get()
    convert_type = to_.get()
    user_input_number = num1.get()

    if user_input_type == 'Meters' and convert_type == 'Inches':
        converted_value = user_input_number * 39.37
    elif user_input_type == 'Meters' and convert_type == 'Foot':
        converted_value = user_input_number * 3.28
    elif user_input_type == 'Inches' and convert_type == 'Meters':
        converted_value = user_input_number / 39.37
    elif user_input_type == 'Foot' and convert_type == 'Inches':
        converted_value = user_input_number * 12
    elif user_input_type == 'Inches' and convert_type == 'Foot':
        converted_value = user_input_number / 12
    elif user_input_type == 'Foot' and convert_type == 'Meters':
        converted_value = user_input_number / 3.28
    else:
        converted_value = user_input_number

    output_number_label = Label(app,text = round(converted_value,2),width=10)
    output_number_label.grid(row=1,colomn=4,pady=5)


conversion_button = Button(app,text='convert',command='onverter')
conversion_button.grid(row='2',colomn='0',pady='5')

app.mainloop()







Zealous Zebra

онлайн компилятор Python для графического интерфейса

from Tkinter import *
root=tk()
Nageh Abdelmonaem

Ответы похожие на “онлайн компилятор Python для графического интерфейса”

Вопросы похожие на “онлайн компилятор Python для графического интерфейса”

Больше похожих ответов на “онлайн компилятор Python для графического интерфейса” по Python

Смотреть популярные ответы по языку

Смотреть другие языки программирования