Presentation: create a Python GUI template using LV Gui to build it
Used LabVIEW(r) cluster for window and frame
# -*- coding: utf-8 -*-
# LabVIEW(r) create python template from LV GUI
#Date: 3/27/2023 Time 11:05 AM
#
from tkinter import *
#GUI setup below
myWindowLVtoPythonGUI=Tk()
myWindowLVtoPythonGUI.title("LV_GUI to Python_GUI.vi")
myWindowLVtoPythonGUI.minsize(564,462)
# do this or frame in window will not follow window (expanding)
myWindowLVtoPythonGUI.grid_rowconfigure(1,weight=1) #need on row define as 1 for expanding row wise bottomframe
myWindowLVtoPythonGUI.grid_columnconfigure(0,weight=1)
#frame1
# adjust r,c,sticky, row and column config as need
frame1=Frame(myWindowLVtoPythonGUI,width=50,height=50,bg='lightblue')
frame1.grid(row=0, column=0, sticky='NWES', padx=10, pady=10, columnspan=4)
frame1.rowconfigure(0,weight=1)
frame1.columnconfigure(4,weight=1) #the lastcol goes along with rigth side expanding
#LED info
LTRY=5 #light top right Y
LTRX=15 #light top right X
dia=20
#Led Indictor
canv1=Canvas(frame1,width=50, height=30, bg='lightblue', bd=0, highlightthickness=0)
canv1.grid(row=2, column=4, columnspan=1)
LED1=canv1.create_oval(LTRX,LTRY,LTRX+dia,LTRY+dia,fill='black')
#Label
APP_NAME=Label(frame1, text=" UUT Testting - Solar Panel Surface ",width=25)
APP_NAME.grid(row=0, column=0, padx=10, pady=10, columnspan=1,sticky='')
#Label
COMPANY_NAME=Label(frame1, text=" mySolarCompany",width=25)
COMPANY_NAME.grid(row=0, column=5, padx=10, pady=10, columnspan=1,sticky='E')
#Label
USERMSG=Label(frame1, text=" Ready For Test",width=25)
USERMSG.grid(row=2, column=5, padx=10, pady=10, columnspan=1,sticky='E')
#Label
RESULT=Label(frame1, text=" Passed",width=25)
RESULT.grid(row=3, column=5, padx=10, pady=10, columnspan=1,sticky='E')
#Button
START_TEST=Button(frame1, text='START_TEST',width=15, command=lambda:frame_Button_START_TEST("START_TEST"))
START_TEST.grid(row=2, column=0,padx=10,pady=10,sticky='')
def frame_Button_START_TEST(button_text):
print(button_text)
return
#last Line
myWindowLVtoPythonGUI.mainloop()
Notes
Presentation: An adventure to attempt LV GUI to Python GUI template
Programming Language used: Python 3.7 in Spyder and LabVIEW®2019
Python and Tkinter are from there respective companies
LabVIEW® is a NI (was National Instruments) product.
Presentation app: Microsoft’s PowerPoint
Presentation shown to spark ideas of use.
This presentation is not connected to or endorsed by any company.
Use at your own risk.
Tags: Python, Python3.7, tkinter , GUI, LabVIEW GUI to Python GUI template example, LabVIEW®,LV2019