Posts

Showing posts from December, 2022

Python Tutorial Gui Tkinter Display Data As Text

Image
Displaying data on Tkinter Window from Database  Using the widget  label.config() Example Code: from tkinter import * import sqlite3 root = Tk() root.geometry("200x200") conn = sqlite3.connect('test1.db') def showdata():    cursor = conn.execute("SELECT id, name, address, salary from COMPANY")    for row in cursor:       l1 = Label(root, text="result")       l1.pack()       l1.config(text=row) b1 = Button(root,text="submit",command=showdata) b1.pack() root.mainloop()

Currency Converter Code Python Tkinter Gui

Image
  Window Creation from tkinter import * root = Tk() root.geometry("320x300") root.title("currency converter") i= PhotoImage(file='') root.iconphoto(False,i) root['bg'] ='#f09942' Widgets Using Entry Button & Label lab = Label(root,text="Currency Converter",relief="raised",borderwidth=2,font= ('Garamond',25),bg='#f09942',padx=20,pady=10) lab.pack(padx=10,pady=10) lab_1 =Label(root,text="USD",font= ('Garamond',25),bg='#f09942') lab_1.pack(padx=2,pady=2) en = Entry(root,highlightthickness=1, width=30) en.pack(padx=2,pady=2) bt = Button(root,text="TO",command=convert,width=10) bt.pack(padx=2,pady=2) lab_2=Label(root,text="INR",font= ('Garamond',25),bg='#f09942') lab_2.pack(padx=2,pady=2) en_1=Entry(root,highlightthickness=1, width=30) en_1.pack(padx=2,pady=2) Button Code (Conversion Method)  [Button,command= convert] def convert():     en_1.delet...