Teaching myself Python Day 2

in ulog •  2 months ago 

This is me continuing to follow the tutorial: https://likegeeks.com/python-gui-examples-tkinter-tutorial/ I am using concepts from the tutorial, but changing the UI to get ready for a future use idea.

Here is the display from today's code which I will post below the picture.

from tkinter import *
from tkinter.ttk import *

window =Tk()
window.title("Pylearn Day 2")
lbl = Label(window, text="hello", font=("Arial Bold", 50))
lbl.grid(column=10, row=10)
lbl1 = Label(window, text="sensor", font=("Arial Bold", 50))
lbl1.grid(column=20, row=20)
txtInput = Entry(window, width=10)
txtInput.grid(column=1, row=0)
combo = Combobox(window)
combo['values']= ("ManCave", "RearDeck", "MCfloor", "Dining")
combo.grid(column=30, row=30)
def clicked1():
    txtcombo = combo.get()
    lbl1.configure(text= txtcombo, font=("Arial Bold", 14))
button_1 = Button(window, text="Sensor", command=clicked1)
button_1.grid(column=1, row=9)
def clicked2():
    txtentered = "hello " + txtInput.get()
    lbl.configure(text= txtentered, font=("Arial Bold", 14))
button_2 = Button(window, text="Click Me!", command=clicked2)
button_2.grid(column=2, row=9)


In my next post I will probably leave the tutorial and use a bit of code I wrote for a previous post.

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

I've been working on tkinter for GUIs too! I made an executable weather application using a tutorial. It allows someone to type in a location and get the weather information.

Python! I love python. It does a little bit of everything a person would want. Awesome stuff! I think everything should learn it.