Wednesday, January 22, 2020

How to write a grid in Tkinter python

from tkinter import *
import tkinter as tk
#ARM Cortex M0",48,16,2,16,1,5,2,1,1,1,8,0,0,"QFN20"
mc_list={
          1: {
                'id':'MM32f003NW',
                'processor':'ARM Cortex M0',
                'frequency':'48',
                'flash':'16',
                'ram':'2',
                "gpio":"16",
                "adv_tm":"1",
                "gptm":"5",
                "wdg":"2",
                "rtc":"",
                "uart":"1",
                "i2c":"1",
                "spi":"1",
                "adc":"8x12bit",
                "eeprom":"0",
                "pack":"QFN20",
                "dac":"",
                "usb":"",
                "can":"",
                "sdio":"",
                "comp":"",
                "aes":"",
                "trng":""
             
            },
            2:{
                "id":"MM32f003TW",
                "processor":"ARM Cortex M0",
                "frequency":"48",
                "flash":"16",
                "ram":"2",
                "gpio":"16",
                "adv_tm":"1",
                "gptm":"5",
                "wdg":"2",
                "rtc":"-",
                "uart":"1",
                "i2c":"1",
                "spi":"1",
                "adc":"8x12bit",
                "eeprom":"0",
                "pack":"TSSOP20",
                "dac":"",
                "usb":"",
                "can":"",
                "sdio":"",
                "comp":"",
                "aes":"",
                "trng":""
                },
#MM32f031 controller started
             3:{
                "id":"MM32F031F4P6",
                "processor":"ARM Cortex M0",
                "frequency":"72",
                "flash":"16",
                "ram":"4",
                "gpio":"16",
                "adv_tm":"1",
                "gptm":"5",
                "wdg":"2",
                "rtc":"-",
                "uart":"1",
                "i2c":"1",
                "spi":"1",
                "adc":"9x12bit",
                "eeprom":"",
                "pack":"TSSOP20",
                "dac":"",
                "usb":"",
                "can":"",
                "sdio":"",
                "comp":"",
                "aes":"",
                "trng":""
                },
            4:{
                "id":"MM32F031F4U6",
                "processor":"ARM Cortex M0",
                "frequency":"72",
                "flash":"16",
                "ram":"4",
                "gpio":"16",
                "adv_tm":"1",
                "gptm":"5",
                "wdg":"2",
                "rtc":"",
                "uart":"1",
                "i2c":"1",
                "spi":"1",
                "adc":"9x12bit",
                "eeprom":"",
                "pack":"QFN20",
                "dac":"",
                "usb":"",
                "can":"",
                "sdio":"",
                "comp":"",
                "aes":"",
                "trng":""
                },
                5:{
                "id":"MM32f031K4U6",
                "processor":"ARM Cortex M0",
                "frequency":"72",
                "flash":"16",
                "ram":"4",
                "gpio":"27",
                "adv_tm":"1",
                "gptm":"5",
                "wdg":"2",
                "rtc":"",
                "uart":"1",
                "i2c":"1",
                "spi":"1",
                "adc":"10x12bit",
                "eeprom":"",
                "pack":"QFN32",
                "dac":"",
                "usb":"",
                "can":"",
                "sdio":"",
                "comp":"",
                "aes":"",
                "trng":""
                },
                  6:{
                "id":"MM32f031K4T6",
                "processor":"ARM Cortex M0",
                "frequency":"72",
                "flash":"16",
                "ram":"4",
                "gpio":"25",
                "adv_tm":"1",
                "gptm":"5",
                "wdg":"2",
                "rtc":"-",
                "uart":"1",
                "i2c":"1",
                "spi":"1",
                "adc":"10x12bit",
                "eeprom":"-",
                "pack":"LQFP32",
                "dac":"",
                "usb":"",
                "can":"",
                "sdio":"",
                "comp":"",
                "aes":"",
                "trng":""
                },
                  7:{
                "id":"MM32f031C4T6",
                "processor":"ARM Cortex M0",
                "frequency":"72",
                "flash":"16",
                "ram":"4",
                "gpio":"39",
                "adv_tm":"1",
                "gptm":"5",
                "wdg":"2",
                "rtc":"",
                "uart":"1",
                "i2c":"1",
                "spi":"1",
                "adc":"10x12bit",
                "eeprom":"",
                "pack":"QFN32",
                "dac":"",
                "usb":"",
                "can":"",
                "sdio":"",
                "comp":"",
                "aes":"",
                "trng":""
                },
                8:{
                "id":"MM32f031K4U6",
                "processor":"ARM Cortex M0",
                "frequency":"72",
                "flash":"16",
                "ram":"4",
                "gpio":"27",
                "adv_tm":"1",
                "gptm":"5",
                "wdg":"2",
                "rtc":"",
                "uart":"1",
                "i2c":"1",
                "spi":"1",
                "adc":"10x12bit",
                "eeprom":"",
                "pack":"QFN32",
                "dac":"",
                "usb":"",
                "can":"",
                "sdio":"",
                "comp":"",
                "aes":"",
                "trng":""
                },
                9:{
                "id":"MM32f031K4U6",
                "processor":"ARM Cortex M0",
                "frequency":"72",
                "flash":"16",
                "ram":"4",
                "gpio":"27",
                "adv_tm":"1",
                "gptm":"5",
                "wdg":"2",
                "rtc":"",
                "uart":"1",
                "i2c":"1",
                "spi":"1",
                "adc":"10x12bit",
                "eeprom":"",
                "pack":"QFN32",
                "dac":"",
                "usb":"",
                "can":"",
                "sdio":"",
                "comp":"",
                "aes":"",
                "trng":""
                },
                10:{
                "id":"MM32f031K4U6",
                "processor":"ARM Cortex M0",
                "frequency":"72",
                "flash":"16",
                "ram":"4",
                "gpio":"27",
                "adv_tm":"1",
                "gptm":"5",
                "wdg":"2",
                "rtc":"",
                "uart":"1",
                "i2c":"1",
                "spi":"1",
                "adc":"10x12bit",
                "eeprom":"",
                "pack":"QFN32",
                "dac":"",
                "usb":"",
                "can":"",
                "sdio":"",
                "comp":"",
                "aes":"",
                "trng":""
                },
                11:{
                "id":"MM32f031K4U6",
                "processor":"ARM Cortex M0",
                "frequency":"72",
                "flash":"16",
                "ram":"4",
                "gpio":"27",
                "adv_tm":"1",
                "gptm":"5",
                "wdg":"2",
                "rtc":"",
                "uart":"1",
                "i2c":"1",
                "spi":"1",
                "adc":"10x12bit",
                "eeprom":"",
                "pack":"QFN32",
                "dac":"",
                "usb":"",
                "can":"",
                "sdio":"",
                "comp":"",
                "aes":"",
                "trng":""
                },
                         12:{
                "id":"MM32f031K4U6",
                "processor":"ARM Cortex M0",
                "frequency":"72",
                "flash":"16",
                "ram":"4",
                "gpio":"27",
                "adv_tm":"1",
                "gptm":"5",
                "wdg":"2",
                "rtc":"",
                "uart":"1",
                "i2c":"1",
                "spi":"1",
                "adc":"10x12bit",
                "eeprom":"",
                "pack":"QFN32",
                "dac":"",
                "usb":"",
                "can":"",
                "sdio":"",
                "comp":"",
                "aes":"",
                "trng":""
                },
                13:{
                "id":"MM32f031K4U6",
                "processor":"ARM Cortex M0",
                "frequency":"72",
                "flash":"16",
                "ram":"4",
                "gpio":"27",
                "adv_tm":"1",
                "gptm":"5",
                "wdg":"2",
                "rtc":"",
                "uart":"1",
                "i2c":"1",
                "spi":"1",
                "adc":"10x12bit",
                "eeprom":"",
                "pack":"QFN32",
                "dac":"",
                "usb":"",
                "can":"",
                "sdio":"",
                "comp":"",
                "aes":"",
                "trng":""
                },
                        14:{
                "id":"MM32f031K4U6",
                "processor":"ARM Cortex M0",
                "frequency":"72",
                "flash":"16",
                "ram":"4",
                "gpio":"27",
                "adv_tm":"1",
                "gptm":"5",
                "wdg":"2",
                "rtc":"",
                "uart":"1",
                "i2c":"1",
                "spi":"1",
                "adc":"10x12bit",
                "eeprom":"",
                "pack":"QFN32",
                "dac":"",
                "usb":"",
                "can":"",
                "sdio":"",
                "comp":"",
                "aes":"",
                "trng":""
                },
                                        15:{
                "id":"MM32f031K4U6",
                "processor":"ARM Cortex M0",
                "frequency":"72",
                "flash":"16",
                "ram":"4",
                "gpio":"27",
                "adv_tm":"1",
                "gptm":"5",
                "wdg":"2",
                "rtc":"",
                "uart":"1",
                "i2c":"1",
                "spi":"1",
                "adc":"10x12bit",
                "eeprom":"",
                "pack":"QFN32",
                "dac":"",
                "usb":"",
                "can":"",
                "sdio":"",
                "comp":"",
                "aes":"",
                "trng":""
                },
                                                        16:{
                "id":"MM32f031K4U6",
                "processor":"ARM Cortex M0",
                "frequency":"72",
                "flash":"16",
                "ram":"4",
                "gpio":"27",
                "adv_tm":"1",
                "gptm":"5",
                "wdg":"2",
                "rtc":"",
                "uart":"1",
                "i2c":"1",
                "spi":"1",
                "adc":"10x12bit",
                "eeprom":"",
                "pack":"QFN32",
                "dac":"",
                "usb":"",
                "can":"",
                "sdio":"",
                "comp":"",
                "aes":"",
                "trng":""
                },        17:{
                "id":"MM32f031K4U6",
                "processor":"ARM Cortex M0",
                "frequency":"72",
                "flash":"16",
                "ram":"4",
                "gpio":"27",
                "adv_tm":"1",
                "gptm":"5",
                "wdg":"2",
                "rtc":"",
                "uart":"1",
                "i2c":"1",
                "spi":"1",
                "adc":"10x12bit",
                "eeprom":"",
                "pack":"QFN32",
                "dac":"",
                "usb":"",
                "can":"",
                "sdio":"",
                "comp":"",
                "aes":"",
                "trng":""
                },
                                                                        18:{
                "id":"MM32f031K4U6",
                "processor":"ARM Cortex M0",
                "frequency":"72",
                "flash":"16",
                "ram":"4",
                "gpio":"27",
                "adv_tm":"1",
                "gptm":"5",
                "wdg":"2",
                "rtc":"",
                "uart":"1",
                "i2c":"1",
                "spi":"1",
                "adc":"10x12bit",
                "eeprom":"",
                "pack":"QFN32",
                "dac":"",
                "usb":"",
                "can":"",
                "sdio":"",
                "comp":"",
                "aes":"",
                "trng":""
                },
############################################################################
##------------------MM32F032-----
##-------------total 8 controllers available------
#############################################################################
                19:{
                "id":"MM32f032K4U6",
                "processor":"ARM Cortex M0",
                "frequency":"72",
                "flash":"16",
                "ram":"4",
                "gpio":"27",
                "adv_tm":"1",
                "gptm":"5",
                "wdg":"2",
                "rtc":"",
                "uart":"1",
                "i2c":"1",
                "spi":"1",
                "adc":"10x12bit",
                "eeprom":"",
                "pack":"QFN32",
                "dac":"",
                "usb":"",
                "can":"",
                "sdio":"",
                "comp":"",
                "aes":"",
                "trng":""
                },
                        20:{
                "id":"MM32f032K4U6",
                "processor":"ARM Cortex M0",
                "frequency":"72",
                "flash":"16",
                "ram":"4",
                "gpio":"27",
                "adv_tm":"1",
                "gptm":"5",
                "wdg":"2",
                "rtc":"",
                "uart":"1",
                "i2c":"1",
                "spi":"1",
                "adc":"10x12bit",
                "eeprom":"",
                "pack":"QFN32",
                "dac":"",
                "usb":"",
                "can":"",
                "sdio":"",
                "comp":"",
                "aes":"",
                "trng":""
                },
                                21:{
                "id":"MM32f032K4U6",
                "processor":"ARM Cortex M0",
                "frequency":"72",
                "flash":"16",
                "ram":"4",
                "gpio":"27",
                "adv_tm":"1",
                "gptm":"5",
                "wdg":"2",
                "rtc":"",
                "uart":"1",
                "i2c":"1",
                "spi":"1",
                "adc":"10x12bit",
                "eeprom":"",
                "pack":"QFN32",
                "dac":"",
                "usb":"",
                "can":"",
                "sdio":"",
                "comp":"",
                "aes":"",
                "trng":""
                },
                22:{
                "id":"MM32f032K4U6",
                "processor":"ARM Cortex M0",
                "frequency":"72",
                "flash":"16",
                "ram":"4",
                "gpio":"27",
                "adv_tm":"1",
                "gptm":"5",
                "wdg":"2",
                "rtc":"",
                "uart":"1",
                "i2c":"1",
                "spi":"1",
                "adc":"10x12bit",
                "eeprom":"",
                "pack":"QFN32",
                "dac":"",
                "usb":"",
                "can":"",
                "sdio":"",
                "comp":"",
                "aes":"",
                "trng":""
                },
                        23:{
                "id":"MM32f032K4U6",
                "processor":"ARM Cortex M0",
                "frequency":"72",
                "flash":"16",
                "ram":"4",
                "gpio":"27",
                "adv_tm":"1",
                "gptm":"5",
                "wdg":"2",
                "rtc":"",
                "uart":"1",
                "i2c":"1",
                "spi":"1",
                "adc":"10x12bit",
                "eeprom":"",
                "pack":"QFN32",
                "dac":"",
                "usb":"",
                "can":"",
                "sdio":"",
                "comp":"",
                "aes":"",
                "trng":""
                },
                                24:{
                "id":"MM32f032K4U6",
                "processor":"ARM Cortex M0",
                "frequency":"72",
                "flash":"16",
                "ram":"4",
                "gpio":"27",
                "adv_tm":"1",
                "gptm":"5",
                "wdg":"2",
                "rtc":"",
                "uart":"1",
                "i2c":"1",
                "spi":"1",
                "adc":"10x12bit",
                "eeprom":"",
                "pack":"QFN32",
                "dac":"",
                "usb":"",
                "can":"",
                "sdio":"",
                "comp":"",
                "aes":"",
                "trng":""
                },
                                        25:{
                "id":"MM32f032K4U6",
                "processor":"ARM Cortex M0",
                "frequency":"72",
                "flash":"16",
                "ram":"4",
                "gpio":"27",
                "adv_tm":"1",
                "gptm":"5",
                "wdg":"2",
                "rtc":"",
                "uart":"1",
                "i2c":"1",
                "spi":"1",
                "adc":"10x12bit",
                "eeprom":"",
                "pack":"QFN32",
                "dac":"",
                "usb":"",
                "can":"",
                "sdio":"",
                "comp":"",
                "aes":"",
                "trng":""
                },
                                        26:{
                "id":"MM32f032K4U6",
                "processor":"ARM Cortex M0",
                "frequency":"72",
                "flash":"16",
                "ram":"4",
                "gpio":"27",
                "adv_tm":"1",
                "gptm":"5",
                "wdg":"2",
                "rtc":"",
                "uart":"1",
                "i2c":"1",
                "spi":"1",
                "adc":"10x12bit",
                "eeprom":"",
                "pack":"QFN32",
                "dac":"",
                "usb":"",
                "can":"",
                "sdio":"",
                "comp":"",
                "aes":"",
                "trng":""
                }
         
                   
            }

def micro_controller_details():
    row_items=1
    d=1
    for i in range(0,26):
        microcontroller=Label(master,text=mc_list[d]['id'],bg="#142E54",fg="white",font="Lato 12 bold",padx="5",pady="5",borderwidth=2,relief="groove").grid(row=row_items,column=0,sticky=N+S+E+W)
        processor=Label(master,text=mc_list[d]['processor'],bg="#142E54",fg="white",font="Lato 12 bold",padx="5",pady="5",borderwidth=2,relief="groove").grid(row=row_items,column=1,sticky=N+S+E+W)
        frequency=Label(master,text=mc_list[d]['frequency'],bg="#142E54",fg="white",font="Lato 12 bold",padx="5",pady="5",borderwidth=2,relief="groove").grid(row=row_items,column=2,sticky=N+S+E+W)
        flash=Label(master,text=mc_list[d]["flash"],bg="#142E54",fg="white",font="Lato 12 bold",padx="5",pady="5",borderwidth=2,relief="groove").grid(row=row_items,column=3,sticky=N+S+E+W)
        ram=Label(master,text=mc_list[d]["ram"],bg="#142E54",fg="white",font="Lato 12 bold",padx="5",pady="5",borderwidth=2,relief="groove").grid(row=row_items,column=4,sticky=N+S+E+W)
        gpio=Label(master,text=mc_list[d]["gpio"],bg="#142E54",fg="white",font="Lato 12 bold",padx="5",pady="5",borderwidth=2,relief="groove").grid(row=row_items,column=5,sticky=N+S+E+W)
        adv_tm=Label(master,text=mc_list[d]["adv_tm"],bg="#142E54",fg="white",font="Lato 12 bold",padx="5",pady="5",borderwidth=2,relief="groove").grid(row=row_items,column=6,sticky=N+S+E+W)
        gptm=Label(master,text=mc_list[d]["gptm"],bg="#142E54",fg="white",font="Lato 12 bold",padx="5",pady="5",borderwidth=2,relief="groove").grid(row=row_items,column=7,sticky=N+S+E+W)
        wdg=Label(master,text=mc_list[d]["wdg"],bg="#142E54",fg="white",font="Lato 12 bold",padx="5",pady="5",borderwidth=2,relief="groove").grid(row=row_items,column=8,sticky=N+S+E+W)
        rtc=Label(master,text=mc_list[d]["rtc"],bg="#142E54",fg="white",font="Lato 12 bold",padx="5",pady="5",borderwidth=2,relief="groove").grid(row=row_items,column=9,sticky=N+S+E+W)
        uart=Label(master,text=mc_list[d]["uart"],bg="#142E54",fg="white",font="Lato 12 bold",padx="5",pady="5",borderwidth=2,relief="groove").grid(row=row_items,column=10,sticky=N+S+E+W)
        i2c=Label(master,text=mc_list[d]["i2c"],bg="#142E54",fg="white",font="Lato 12 bold",padx="5",pady="5",borderwidth=2,relief="groove").grid(row=row_items,column=11,sticky=N+S+E+W)
        spi=Label(master,text=mc_list[d]["spi"],bg="#142E54",fg="white",font="Lato 12 bold",padx="5",pady="5",borderwidth=2,relief="groove").grid(row=row_items,column=12,sticky=N+S+E+W)
        adc=Label(master,text=mc_list[d]["adc"],bg="#142E54",fg="white",font="Lato 12 bold",padx="5",pady="5",borderwidth=2,relief="groove").grid(row=row_items,column=13,sticky=N+S+E+W)
        eeprom=Label(master,text=mc_list[d]["eeprom"],bg="#142E54",fg="white",font="Lato 12 bold",padx="5",pady="5",borderwidth=2,relief="groove").grid(row=row_items,column=14,sticky=N+S+E+W)
        pack=Label(master,text=mc_list[d]["pack"],bg="#142E54",fg="white",font="Lato 12 bold",padx="5",pady="5",borderwidth=2,relief="groove").grid(row=row_items,column=15,sticky=N+S+E+W)
        dac=Label(master,text=mc_list[d]["dac"],bg="#142E54",fg="white",font="Lato 12 bold",padx="5",pady="5",borderwidth=2,relief="groove").grid(row=row_items,column=16,sticky=N+S+E+W)
        usb=Label(master,text=mc_list[d]["usb"],bg="#142E54",fg="white",font="Lato 12 bold",padx="5",pady="5",borderwidth=2,relief="groove").grid(row=row_items,column=17,sticky=N+S+E+W)
        can=Label(master,text=mc_list[d]["can"],bg="#142E54",fg="white",font="Lato 12 bold",padx="5",pady="5",borderwidth=2,relief="groove").grid(row=row_items,column=18,sticky=N+S+E+W)
        sdio=Label(master,text=mc_list[d]["sdio"],bg="#142E54",fg="white",font="Lato 12 bold",padx="5",pady="5",borderwidth=2,relief="groove").grid(row=row_items,column=19,sticky=N+S+E+W)
        comp=Label(master,text=mc_list[d]["comp"],bg="#142E54",fg="white",font="Lato 12 bold",padx="5",pady="5",borderwidth=2,relief="groove").grid(row=row_items,column=20,sticky=N+S+E+W)
        aes=Label(master,text=mc_list[d]["aes"],bg="#142E54",fg="white",font="Lato 12 bold",padx="5",pady="5",borderwidth=2,relief="groove").grid(row=row_items,column=21,sticky=N+S+E+W)
        trng=Label(master,text=mc_list[d]["trng"],bg="#142E54",fg="white",font="Lato 12 bold",padx="5",pady="5",borderwidth=2,relief="groove").grid(row=row_items,column=22,sticky=N+S+E+W)
        row_items=row_items+1
        d=d+1
 

     
     

'''def details(processor,frequency,flash,ram,gpio,adv_tm,gptm,wdg,rtc,uart,i2c,spi,adc,eeprom="-",pack="-",dac="-",usb="",can="",sdio=0,comp=0,aes=0,trng=0,**para):
    T.insert(tk.END, "===========================================================================\n")
    T.insert(tk.END, "Max speed in hz\t\tFLASH\t\tRAM\t\tGPIO\n")
    T.insert(tk.END, "=========================================================================\n")
    T.insert(tk.END,"PROCESSOR::======>{}\n".format(processor))
    T.insert(tk.END,"Frequency Max speed ::====>{}Mhz\n".format(frequency))
    T.insert(tk.END,"FLASH::====>{}KBytes\n".format(flash))
    T.insert(tk.END,"RAM::====>{}KBytes\n".format(ram))
    T.insert(tk.END,"GPIO::====>{}Pins\n".format(gpio))
    T.insert(tk.END,"Advanced timer::====>{}\n".format(adv_tm))
    T.insert(tk.END,"GPTM::====>{}\n".format(gptm))
    T.insert(tk.END,"WDG::====>{}\n".format(wdg))
    T.insert(tk.END,"RTC::====>{}\n".format(rtc))
    T.insert(tk.END,"UART::====>{}\n".format(uart))
    T.insert(tk.END,"I2C::====>{}\n".format(i2c))
    T.insert(tk.END,"SPI::====>{}\n".format(spi))
    T.insert(tk.END,"ADC::====>{}x12bit\n".format(adc))
    T.insert(tk.END,"EEPROM::====>{}KBytes\n".format(eeprom))
    T.insert(tk.END,"PACk::====>{}\n".format(pack))
    T.insert(tk.END,"DAC::====>{}\n".format(dac))
    T.insert(tk.END,"USB::====>{}\n".format(usb))
    T.insert(tk.END,"CAN::====>{}\n".format(can))
    T.insert(tk.END,"SDIO::====>{}\n".format(sdio))
    T.insert(tk.END,"COMP::====>{}\n".format(comp))
    T.insert(tk.END,"AES::====>{}\n".format(aes))
    T.insert(tk.END,"TRNG::====>{}\n".format(trng))
    T.insert(tk.END,"===========================================================================\n")
''' 

#####------------------main program start_here-----------------
master = tk.Tk()
#scrollbar = Scrollbar(master)
#scrollbar.grid( side = RIGHT, fill=Y )

#mylist = Listbox(master, yscrollcommand = scrollbar.set )
microcontroller=Label(master,text="microcontroller",bg="#142E54",fg="white",font="Lato 12 bold",padx="5",pady="5",borderwidth=2,relief="groove").grid(row=0,column=0,sticky=N+S+E+W)
processor=Label(master,text="Processor",bg="#142E54",fg="white",font="Lato 12 bold",padx="5",pady="5",borderwidth=2,relief="groove").grid(row=0,column=1,sticky=N+S+E+W)
frequency=Label(master,text="Frequency",bg="#142E54",fg="white",font="Lato 12 bold",padx="5",pady="5",borderwidth=2,relief="groove").grid(row=0,column=2,sticky=N+S+E+W)
flash=Label(master,text="Flash",bg="#142E54",fg="white",font="Lato 12 bold",padx="5",pady="5",borderwidth=2,relief="groove").grid(row=0,column=3,sticky=N+S+E+W)
ram=Label(master,text="RAM",bg="#142E54",fg="white",font="Lato 12 bold",padx="5",pady="5",borderwidth=2,relief="groove").grid(row=0,column=4,sticky=N+S+E+W)
gpio=Label(master,text="GPIO",bg="#142E54",fg="white",font="Lato 12 bold",padx="5",pady="5",borderwidth=2,relief="groove").grid(row=0,column=5,sticky=N+S+E+W)
adv_tm=Label(master,text="Adv TM",bg="#142E54",fg="white",font="Lato 12 bold",padx="5",pady="5",borderwidth=2,relief="groove").grid(row=0,column=6,sticky=N+S+E+W)
gptm=Label(master,text="GPTM",bg="#142E54",fg="white",font="Lato 12 bold",padx="5",pady="5",borderwidth=2,relief="groove").grid(row=0,column=7,sticky=N+S+E+W)
wdg=Label(master,text="WDG",bg="#142E54",fg="white",font="Lato 12 bold",padx="5",pady="5",borderwidth=2,relief="groove").grid(row=0,column=8,sticky=N+S+E+W)
rtc=Label(master,text="RTC",bg="#142E54",fg="white",font="Lato 12 bold",padx="5",pady="5",borderwidth=2,relief="groove").grid(row=0,column=9,sticky=N+S+E+W)
uart=Label(master,text="UART",bg="#142E54",fg="white",font="Lato 12 bold",padx="5",pady="5",borderwidth=2,relief="groove").grid(row=0,column=10,sticky=N+S+E+W)
i2c=Label(master,text="I2C",bg="#142E54",fg="white",font="Lato 12 bold",padx="5",pady="5",borderwidth=2,relief="groove").grid(row=0,column=11,sticky=N+S+E+W)
spi=Label(master,text="SPI",bg="#142E54",fg="white",font="Lato 12 bold",padx="5",pady="5",borderwidth=2,relief="groove").grid(row=0,column=12,sticky=N+S+E+W)
adc=Label(master,text="ADC",bg="#142E54",fg="white",font="Lato 12 bold",padx="5",pady="5",borderwidth=2,relief="groove").grid(row=0,column=13,sticky=N+S+E+W)
eeprom=Label(master,text="EEPROM",bg="#142E54",fg="white",font="Lato 12 bold",padx="5",pady="5",borderwidth=2,relief="groove").grid(row=0,column=14,sticky=N+S+E+W)
pack=Label(master,text="PACK",bg="#142E54",fg="white",font="Lato 12 bold",padx="5",pady="5",borderwidth=2,relief="groove").grid(row=0,column=15,sticky=N+S+E+W)
dac=Label(master,text="DAC",bg="#142E54",fg="white",font="Lato 12 bold",padx="5",pady="5",borderwidth=2,relief="groove").grid(row=0,column=16,sticky=N+S+E+W)
usb=Label(master,text="USB",bg="#142E54",fg="white",font="Lato 12 bold",padx="5",pady="5",borderwidth=2,relief="groove").grid(row=0,column=17,sticky=N+S+E+W)
can=Label(master,text="CAN",bg="#142E54",fg="white",font="Lato 12 bold",padx="5",pady="5",borderwidth=2,relief="groove").grid(row=0,column=18,sticky=N+S+E+W)
sdio=Label(master,text="SDIO",bg="#142E54",fg="white",font="Lato 12 bold",padx="5",pady="5",borderwidth=2,relief="groove").grid(row=0,column=19,sticky=N+S+E+W)
comp=Label(master,text="COMP",bg="#142E54",fg="white",font="Lato 12 bold",padx="5",pady="5",borderwidth=2,relief="groove").grid(row=0,column=20,sticky=N+S+E+W)
aes=Label(master,text="AES",bg="#142E54",fg="white",font="Lato 12 bold",padx="5",pady="5",borderwidth=2,relief="groove").grid(row=0,column=21,sticky=N+S+E+W)
trng=Label(master,text="TRNG",bg="#142E54",fg="white",font="Lato 12 bold",padx="5",pady="5",borderwidth=2,relief="groove").grid(row=0,column=22,sticky=N+S+E+W)

         
#micro_controller_details(1)
#micro_controller_details(2)
micro_controller_details()


#mylist.pack( side = LEFT, fill = BOTH )
#scrollbar.config( command = mylist.yview )


tk.mainloop()

print(mc_list)
#print(mc_list[2])
print("end of the program\n")

label printing in Tkinter python


from tkinter import *
import tkinter as tk

def show_entry_fields():
    print("First Name: %s\nLast Name: %s" % (e1.get(), e2.get()))
#processor,frequency,flash,ram,gpio,adv_tm,gptm,wdg,rtc,uart,i2c,spi,adc,eeprom="-",pack="-",dac="-",usb="",can="",sdio=0,comp=0,aes=0,trng=0

#####------------------main program start_here-----------------
master = tk.Tk()
#scrollbar = Scrollbar(master)
#scrollbar.pack( side = RIGHT, fill=Y )

#mylist = Listbox(root, yscrollcommand = scrollbar.set )
processor=Label(master,text="processor",bg="black",fg="white").grid(row=0,column=0,sticky=N+S+E+W)
frequency=Label(master,text="frequency",bg="white",fg="black").grid(row=0,column=1,sticky=N+S+E+W)
flash=Label(master,text="flash",bg="black",fg="white").grid(row=0,column=2,sticky=N+S+E+W)
ram=Label(master,text="ram",bg="white",fg="black").grid(row=0,column=3,sticky=N+S+E+W)
gpio=Label(master,text="gpio",bg="black",fg="white").grid(row=0,column=4,sticky=N+S+E+W)
adv_tm=Label(master,text="adv_tm",bg="black",fg="white").grid(row=0,column=5,sticky=N+S+E+W)
gptm=Label(master,text="gptm",bg="black",fg="white").grid(row=0,column=6,sticky=N+S+E+W)
wdg=Label(master,text="wdg",bg="black",fg="white").grid(row=0,column=7,sticky=N+S+E+W)
rtc=Label(master,text="rtc",bg="black",fg="white").grid(row=0,column=8,sticky=N+S+E+W)
uart=Label(master,text="uart",bg="black",fg="white").grid(row=0,column=9,sticky=N+S+E+W)
i2c=Label(master,text="i2c",bg="black",fg="white").grid(row=0,column=10,sticky=N+S+E+W)
spi=Label(master,text="spi",bg="black",fg="white").grid(row=0,column=11,sticky=N+S+E+W)
adc=Label(master,text="adc",bg="black",fg="white").grid(row=0,column=12,sticky=N+S+E+W)
eeprom=Label(master,text="eeprom",bg="black",fg="white").grid(row=0,column=13,sticky=N+S+E+W)
pack=Label(master,text="pack",bg="black",fg="white").grid(row=0,column=14,sticky=N+S+E+W)
dac=Label(master,text="dac",bg="black",fg="white").grid(row=0,column=15,sticky=N+S+E+W)
usb=Label(master,text="usb",bg="black",fg="white").grid(row=0,column=16,sticky=N+S+E+W)
can=Label(master,text="can",bg="black",fg="white").grid(row=0,column=17,sticky=N+S+E+W)
sdio=Label(master,text="sdio",bg="black",fg="white").grid(row=0,column=18,sticky=N+S+E+W)
comp=Label(master,text="comp",bg="black",fg="white").grid(row=0,column=19,sticky=N+S+E+W)
aes=Label(master,text="aes",bg="black",fg="white").grid(row=0,column=20,sticky=N+S+E+W)
trng=Label(master,text="trng",bg="black",fg="white").grid(row=0,column=21,sticky=N+S+E+W)



#mylist.pack( side = LEFT, fill = BOTH )
#scrollbar.config( command = mylist.yview )
tk.mainloop()
print("end of the program\n")

scroll bar in python tkinter

from tkinter import *
import tkinter as tk
#from Tkinter import *

root = Tk()
scrollbar = Scrollbar(root)
scrollbar.pack( side = RIGHT, fill=Y )

mylist = Listbox(root, yscrollcommand = scrollbar.set )
for line in range(100):
   mylist.insert(END, "This is line number " + str(line))

mylist.pack( side = LEFT, fill = BOTH )
scrollbar.config( command = mylist.yview )

root.mainloop()

Wednesday, January 1, 2020

Monday, December 30, 2019

EC25 adb and fastboot devices installation of ubuntu linux


How to install android drivers on ubuntu


How to Install ADB & Fastboot on Ubuntu 16.04, 16.10, 14.04



This tutorial is going to show you how to install ADB & fastboot on Ubuntu 16.04, 14.04, 16.10, which is quite easy.
What is ADB and Fastboot
ADB and fastboot are two components of the Android SDK Platform-Tools.
ADB stands for Android Debug Bridge. It’s a command line utility that allows you to do the following stuff:
  • Control your Android device over USB from your computer
  • Copy files back and forth
  • install and uninstall apps
  • run shell commands
  • and much more
Fastboot is a command line tool for flashing and Android device, boot an Android device to fastboot mode, etc…
How to Install ADB and Fastboot on Ubuntu 16.04, 16.10, 14.04
It’s super easy. Simply run the following commands in a terminal window to install them from Ubuntu repository.
sudo apt update
sudo apt install android-tools-adb android-tools-fastboot
To check ADB version, run
adb version
Sample output:
Android Debug Bridge version 1.0.32
Enable USB Debugging on Your Android Device
While you Android device is unplugged from USB, go to your Android settings, scroll all the way down and tap About phone or About device. Then tap Build number 7 times which makes you a developer.
Now go back to the settings, you will see a new button called Developer options. Tap that button and enable USB debugging.
Test the Installation
To check if ADB is working properly, connect your Android device to your Ubuntu computer via USB cable. After that, type the following command in your Ubuntu terminal window.
adb devices
You will be prompted to allow USB debugging from Ubuntu computer like the screenshot below. Select OK.

Then type run adb devices command again and your Android device will show up.

If you get the following error,
????????????    no permissions
Then all you need to do is restart adb daemon, run
sudo adb kill-server
Then
sudo adb start-server


EC25 basic commands list

use qcomm for debug which support at commands ..tool is very useful
download here


Friday, December 27, 2019

How to add a image to tkinter python

# -*- coding: utf-8 -*-
"""
Created on Fri Dec 27 14:38:52 2019

@author: Onyx1
"""
from tkinter import *
import tkinter as tk
from PIL import ImageTk, Image
from tkinter import ttk


#path = 'C:/xxxx/xxxx.jpg'
path = 'F:\my_workspace\python_workspace\onyx-logo.png'


root = tk.Tk()
img = ImageTk.PhotoImage(Image.open(path))
panel = tk.Label(root, image = img)
panel.pack(side = "bottom", fill = "both", expand = "yes")
root.mainloop()

output:


Saturday, December 21, 2019

Html table using python

# -*- coding: utf-8 -*-
"""
Created on Sat Dec 21 18:01:13 2019

@author: anil durgam
"""
import os
 
html = ""
def table(x):
global html
""" Create table with data in a multiline
string as first argument x)"""
html = "<!-- table -->"
html += "<table border=1>"
for line in x.splitlines():
for n in line.split():
html += f"<td>{n}</td>"
html += "<tr>"
html += "</table>"
return html

def create(a):
tab = table(text.get("1.0", tk.END))
text.delete("1.0", tk.END)
text.insert("1.0", tab)
label['text'] = "Now you can copy the html code for the table (ctrl + a)"

def save_html():
if html != "":
with open("table.html", "w") as file:
file.write(text.get("1.0", tk.END))

def show_html():
if os.path.exists("table.html"):
os.startfile("table.html")

def convert_to_html():
html = table(text.get("1.0",tk.END))
clear()
text.insert("1.0", html)

def clear():
text.delete("1.0", tk.END)

import tkinter as tk
root = tk.Tk()
root.title("Html table converter")
label = tk.Label(root, text="Insert data here separated by space and press Ctrl+c to convert to html table:")
label.pack()
text = tk.Text(root)
text.pack()
text.bind("<Control-c>", create)
text.focus()
# create a toplevel menu
menubar = tk.Menu(root)
menubar.add_command(label="Convert - crtl+c |", command=convert_to_html)
menubar.add_command(label="Save  |", command=save_html)
menubar.add_command(label="Show  |", command=show_html)
menubar.add_command(label="Clear screen  |", command=clear)
# display the menu
root.config(menu=menubar)
root.mainloop()

output:



tkinter nested for loop in python

# !/usr/bin/python3
from  tkinter import *
root = Tk(  )
b = 0
for r in range(6):
   for c in range(6):
      b = b + 1
      Button(root, text = str(b), borderwidth = 1 ).grid(row = r,column = c)

root.mainloop()

output:

set in python


s={10,20,30,40}
print(s)
print(type(s))


output:
{40, 10, 20, 30}
<class 'set'>

example 2:
s={10,20,30,40}
s1=s
print(s)
print(type(s))
print(id(s1),id(s))

output:
{40, 10, 20, 30}
<class 'set'>
1861259155048 1861259155048

In above case both s1 and s representing same id
but copying is not done


example 3:
by copy method

s={10,20,30,40}
s1=s.copy()
print(s)
print(type(s))
print(id(s1),id(s))

output:
{40, 10, 20, 30}
<class 'set'>
1861259156840 1861259157288

both s1 and s address are different

Friday, December 20, 2019

drop down menu in python using Tkinter

# -*- coding: utf-8 -*-
"""
Created on Fri Dec 20 13:15:37 2019

@author: anil durgam
version:1.0
example:MM32 microcontroller drop down menu
"""

from tkinter import ttk
import tkinter as tk
#from pprint import pprint
#scr = Tk()


class Application(ttk.Frame):
   
    def __init__(self, main_window):
        super().__init__(main_window)
        main_window.title("MM32_MENU_SELECTOR")
        tk.Label(main_window,text="MM32 microcontroller selected",fg = "blue",font = "Times").pack()
       
        self.combo = ttk.Combobox(self)
        self.combo.place(x=50, y=50)
        self.combo["values"] = ["MM32F", "MM32L",  "MM32W", "MM32SPIN", "MM32P"]
        self.combo.bind("<<ComboboxSelected>>", self.selection_changed)
           
        main_window.configure(width=1024, height=500)
        self.place(width=300, height=200)
       
    def selection_changed(self, event):
        print("your selected::", self.combo.get())
        if self.combo.get()== "MM32F" :
            print("mm32f submenu displayed here\n")
            self.combo = ttk.Combobox(self)
            self.combo.place(x=50, y=100)
            self.combo["values"] = ["MM32F003", "MM32F031", "MM32F032", "MM32F103"]
            self.combo.bind("<<ComboboxSelected>>", self.selection_changed)
           
            if self.combo.get()=="MM32F003":
                 print("mm32f003 submenu displayed here\n")
                 self.combo = ttk.Combobox(self)
                 self.combo.place(x=50, y=150)
                 self.combo["values"] = ["MM32F003TW", "MM32F003NW"]
                 self.combo.bind("<<ComboboxSelected>>", self.selection_changed)
               
           
        elif self.combo.get()== "MM32L" :
            print("mm32L submenu displayed here\n")
            self.combo = ttk.Combobox(self)
            self.combo.place(x=50, y=100)
            self.combo["values"] = ["MM32L050", "MM32L051", "MM32L052", "MM32L061",
                      "MM32L062","MM32L072","MM32L073","MM32L362","MM32L373","MM32L384",
                      "MM32L395"]
            self.combo.bind("<<ComboboxSelected>>", self.selection_changed)
         
       
        elif self.combo.get()== "MM32W" :
            print("mm32W submenu displayed here\n")
            self.combo = ttk.Combobox(self)
            self.combo.place(x=50, y=100)
            self.combo["values"] = ["MM32W051", "MM32W062", "MM32W073", "MM32W362"
                      , "MM32W373", "MM32W384", "MM32W395"]
            self.combo.bind("<<ComboboxSelected>>", self.selection_changed)
         
           
        elif self.combo.get()== "MM32SPIN" :
            print("mm32SPIN submenu displayed here\n")
            self.combo = ttk.Combobox(self)
            self.combo.place(x=50, y=100)
            self.combo["values"] = ["MM32F003", "MM32F031", "MM32F032", "MM32F103"]
            self.combo.bind("<<ComboboxSelected>>", self.selection_changed)
           
       
        else :
            print("mm32P submenu displayed here\n")
            self.combo = ttk.Combobox(self)
            self.combo.place(x=50, y=100)
            self.combo["values"] = ["MM32F003", "MM32F031", "MM32F032", "MM32F103"]
            self.combo.bind("<<ComboboxSelected>>", self.selection_changed)
main_window = tk.Tk()
#lbl.pack()
#pprint(dict(lbl))
#root = tk.Tk()
T = tk.Text(main_window,width=100, height=10)
T.pack()
T.insert(tk.END, "MM32 main details\navailable here\n")

app = Application(main_window)
app.mainloop()



python class topic video