# -*- coding: utf-8 -*- # Programm : GWInstekPowerSupply-GPP-4323_GUI-Kommunikation_Rev8-0_26Nov2024.py # Python 3 Programm; Remoteprogram for GWInstek Power Supply GPP-4323. # Autor: Dipl.-Ing. Bernd Wiebus alias DL1EIC # Burscheid/Germany 26Nov2024 # Rights: GNU-GPL # contact: bernd.wiebus@gmx.de import tkinter from tkinter.filedialog import * # Weil das Modul "Frame" in tkinter.filedialog steckt??? from tkinter import messagebox import serial import time import sys class Values(object): """ Defining an objekt which contains all used global Values """ stSerialChannelName = "COM7" stSetVoltage1 = "" stSetCurrent1 = "" stSetVoltage2 = "" stSetCurrent2 = "" stSetVoltage3 = "" stSetCurrent3 = "" stSetVoltage4 = "" stSetCurrent4 = "" stSwitchChannel1 = "OFF" stSwitchChannel2 = "OFF" stSwitchChannel3 = "OFF" stSwitchChannel4 = "OFF" stSetVoltageChannel1 = "" stSetCurrentChannel1 = "" stSetVoltageChannel2 = "" stSetCurrentChannel2 = "" stSetVoltageChannel3 = "" stSetCurrentChannel3 = "" stSetVoltageChannel4 = "" stSetCurrentChannel4 = "" stPythonVersion = "Python Vers.:" + sys.version[0:8] stManufacturer = "" stType = "" stSerialnumber = "" stFirmwareVersion = "" # Communication with PowerSupply def Communication(stComString): antwort = "" #Damit stFirmwareVersion existiert, wenn keine Antwort kommt try: with serial.Serial(Values.stSerialChannelName, 115200, timeout=0.5) as ComInterfacedefinition: #ComInterfacedefinition = serial.Serial(Values.stSerialChannelName, 115200, timeout=1) if not ComInterfacedefinition.isOpen(): ComInterfacedefinition.open() ComInterfacedefinition.flushInput() ComInterfacedefinition.write(stComString) ComInterfacedefinition.flushInput() antwort =ComInterfacedefinition.read(50) ComInterfacedefinition.close() except IndexError: print("Problem with IndexError") except serial.SerialException: antwort = b'IO ERROR ,E R R O R,SN:none\n' print("no IO port in communication") exit finally: print("End of IO-Sequence") return antwort # Fragt Type und Seriennummer ab def TypeSeriennummer(): bBytesequencedummy = b'IO ERROR ,E R R O R,SN:none,Version:none\n' stManufacturer = "" #Damit stManufacturer existiert, wenn keine Antwort kommt. stSerialnumber = "" #Damit stSerialnumber existiert, wenn keine Antwort kommt stType = "" #Damit stType existiert, wenn keine Antwort kommt stFirmwareVersion = "" #Damit stFirmwareVersion existiert, wenn keine Antwort kommt stComSend = (b'*IDN?\n') # Ask for type, serialnumber bBytesequencedummy = Communication(stComSend) Decodetantwort=bBytesequencedummy.decode("utf-8") Aufgeloest=(Decodetantwort.split(",")) try: stManufacturer = Aufgeloest[0] stType = Aufgeloest[1] stSerialnumber = Aufgeloest[2] stFirmwareVersion = Aufgeloest[3] except IndexError: print("Schnittstelle existiert nicht oder List out of Range") tkinter.messagebox.showerror("Error", LocalisationFile.stErrorCOM) exit except serial.SerialException: #antwort = b'IO ERROR ,E R R O R,SN:none\n' print("no IO port ") tkinter.messagebox.showerror("Error", LocalisationFile.stErrorCOM) exit #stFirmwareVersion = stFirmwareVersion.rstrip() Values.stMaufacturer = stManufacturer + " " Values.stSerialnumber = stSerialnumber + " " Values.stType = stType Values.stFirmwareVersion = stFirmwareVersion if LocalisationFile.SemaphorEnglish == True: LocaBritish() if LocalisationFile.SemaphorGerman == True: LocaGerman() # Switch all Chanels on def AllChannelsON(): stComSend = (b'allouton\n') # All channels on stComReceive = Communication(stComSend) # Switch all Chanels off def AllChannelsOFF(): stComSend = (b'alloutoff\n') # All channels off stComReceive = Communication(stComSend) # Switch Chanel 1 on def Channel1ON(): stComSend = (b'output1:state on\n') # Channel 1 on stComReceive = Communication(stComSend) # Switch Chanel 2 on def Channel2ON(): stComSend = (b'output2:state on\n') # Channel 2 on stComReceive = Communication(stComSend) # Switch Chanel 3 on def Channel3ON(): stComSend = (b'output3:state on\n') # Channel 3 on stComReceive = Communication(stComSend) # Switch Chanel 4 on def Channel4ON(): stComSend = (b'output4:state on\n') # Channel 4 on stComReceive = Communication(stComSend) # Switch Chanel 1 off def Channel1OFF(): stComSend = (b'output1:state off\n') # Channel 1 off stComReceive = Communication(stComSend) # Switch Chanel 2 off def Channel2OFF(): stComSend = (b'output2:state off\n') # Channel 2 off stComReceive = Communication(stComSend) # Switch Chanel 3 off def Channel3OFF(): stComSend = (b'output3:state off\n') # Channel 3 off stComReceive = Communication(stComSend) # Switch Chanel 4 off def Channel4OFF(): stComSend = (b'output4:state off\n') # Channel 4 off stComReceive = Communication(stComSend) # Switch remote controll off and local control on def Local(): stComSend = (b'LOCAL\n') # Switch to Local stComReceive = Communication(stComSend) # Switch remote controll on and local control off def Remote(): stComSend = (b'REMOTE\n') # Switch to Local stComReceive = Communication(stComSend) class ChangeColoursContrast(object): stBackground1 = "#002040" # background #002040 is dark blue stBackground2 = "#304000" # background "#304000" is drab green stBackground3 = "#408000" # background "#408000" is green stBackground4 = "#FFFF5F" #background "#FFFF5F" is yellow stBackground5On ="#800000" #background "#FFFF5F" is dark red stBackground5Off ="#408000" # background "#408000" is green stBackground6 ="#800000" #background "#FFFF5F" is dark red stForeground1 = "#FFFF5F" #foreground = "#FFFF5F" is yellow, Text stForeground2 = "#000000" #foreground = "#000000" is black, Text, everytime black #Icon with British flag IconBritish ="""R0lGODlhJAAYAIQRAFIR+PgREewbItkwRNQyRtUzR+UwP+YxP9w+UOc/Tdt CVOdGVOdHVOdHVelUYP3n6ezw9////////////////////////////////////////////////// //////////ywAAAAAJAAYAAAFvmAQPE8UAWiKmo4jmqpqivRYnvEatS+ezzRg7xdhMIYxoGkZqcG SxWPgKWtOlzqnD2BqNJDCK1Fb9YKtyFxWzI0gEAIBs0dVr5+md3x+reuYgIAFBXSBhoeHg4WISwM DNZCRkpMijo6UmJmVj5qdnp+gfYxLBASLo6hMpaeMdkpLCgpnaXYpryaxs2yuS2cLCwcHda+8xG2 /wcNWfm1ktlEGBswQELRhykbR09Vs11s6LQkJzHe9Qd9t4ePo5SEAOw==""" #Icon with German flag IconDeutsch = """R0lGODlhJAAYAKEDAAAAAPgREfj2Ef///yH5BAEKAAMALAAAAAAkABgAAAI0 hI+py+0Po5y02ouz3jD4D4biSJbmiabqyrbuC8fyjAr2jef6zvf+DwwKh8Si8YhMKpfAAgA7""" def ChangeColour(): ChangeColoursContrast.stBackground1 = "#002040" # background #002040 is dark blue ChangeColoursContrast.stBackground2 = "#304000" # background "#304000" is drab green ChangeColoursContrast.stBackground3 ="#408000" # background "#408000" is green ChangeColoursContrast.stBackground4 ="#FFFF5F" #background "#FFFF5F" is yellow ChangeColoursContrast.stBackground5On ="#800000" #background "#FFFF5F" is dark red ChangeColoursContrast.stBackground5Off ="#408000" # background "#408000" is green ChangeColoursContrast.stBackground6 ="#800000" #background "#FFFF5F" is dark red ChangeColoursContrast.stForeground1 = "#FFFF5F" #foreground = "#FFFF5F" is yellow, Text ChangeColoursContrast.stForeground2 = "#000000" #foreground = "#000000" is black, Text, everytime black #Icon with British flag ChangeColoursContrast.IconBritish ="""R0lGODlhJAAYAIQRAFIR+PgREewbItkwRNQyRtUzR+UwP+YxP9w+UOc/Tdt CVOdGVOdHVOdHVelUYP3n6ezw9////////////////////////////////////////////////// //////////ywAAAAAJAAYAAAFvmAQPE8UAWiKmo4jmqpqivRYnvEatS+ezzRg7xdhMIYxoGkZqcG SxWPgKWtOlzqnD2BqNJDCK1Fb9YKtyFxWzI0gEAIBs0dVr5+md3x+reuYgIAFBXSBhoeHg4WISwM DNZCRkpMijo6UmJmVj5qdnp+gfYxLBASLo6hMpaeMdkpLCgpnaXYpryaxs2yuS2cLCwcHda+8xG2 /wcNWfm1ktlEGBswQELRhykbR09Vs11s6LQkJzHe9Qd9t4ePo5SEAOw==""" #Icon with German flag ChangeColoursContrast.IconDeutsch = """R0lGODlhJAAYAKEDAAAAAPgREfj2Ef///yH5BAEKAAMALAAAAAAkABgAAAI0 hI+py+0Po5y02ouz3jD4D4biSJbmiabqyrbuC8fyjAr2jef6zvf+DwwKh8Si8YhMKpfAAgA7""" update() def ChangeContrast(): ChangeColoursContrast.stBackground1 = "#E8E0E0" # background #002040 is grey ChangeColoursContrast.stBackground2 = "#D1C9C9" # background "#304000" is dark grey ChangeColoursContrast.stBackground3 = "#FFFFFF" # background "#FFFFF" is white ChangeColoursContrast.stBackground4 = "#FFFFFF" #background "#FFFFFF" is white ChangeColoursContrast.stBackground5On = "#D1C9C9" # background "#304000" is dark grey ChangeColoursContrast.stBackground5Off = "#FFFFFF" #background "#FFFFFF" is white ChangeColoursContrast.stBackground6 = "#D1C9C9" # background "#304000" is dark grey ChangeColoursContrast.stForeground1 = "#000000" #foreground = "#000000" is black, Text ChangeColoursContrast.stForeground2 = "#000000" #foreground = "#000000" is black, Text, everytime black #Icon with British text ChangeColoursContrast.IconBritish ="""iVBORw0KGgoAAAANSUhEUgAAACQAAAAYCAYAAACSuF9OAAAACXBIWXMAAA7EAAA OxAGVKw4bAAABBklEQVRIie2WsQ6CMBCG/yLpSKKrvhuGGnYTHoOEwcEQUhPeTVd9AqyDOdNCy+GkQ7/xuG s/7o4E0Wtt8EckvxYYE4U4ohBHFOJIx4FhGFCUpRPrtQYA5Ep540SuFHqtJ3mUS8+JY1Whqet5oaIsgxetk gSXrpvEfVDcGAMhhFPTnc+QUuL+eEzqFo0sdOkSbBlCShnMdzo098YAMDyfyJXCbrvF9XZzcrlawje6oJCN MQb7w8E5aG5km/Xaqbf36JsOO0K2vRAiuMw+xvswJxFafMCzQ1mWsZcD7w4SS8e1hMnITk0TtKcdImwJ39f0uSRNodvWOSvUJRH/hxiiEE cU4ohCHC/mnnvIzad34AAAAABJRU5ErkJggg==""" #Icon with German text ChangeColoursContrast.IconDeutsch = """iVBORw0KGgoAAAANSUhEUgAAACQAAAAYCAYAAA CSuF9OAAAACXBIWXMAAA7EAAAOxAGVKw4bAAABTElEQVRIie2WsW6DMBCGfxtbSpkYmudrGxJ4mgz dItSL5AfM1CwUbDpdauMaUqlqGfgWJN/5/J/9GxCGaMCCkP8tYMwqaI5V0ByroDkUAPR9j7Kug4Ah AgA8leW347uqgrU2GgcA5xxeDgcYouT8YRjwvN9HMQUAZV0HBVmIIYLWGm+nU9SJVgrnpgnyz02DL MsgZbjxXNs5dxPIY+N1k0fGiV3XpVIihiF+6ed5/rWYlDBEyGTaKYp3IoXWOuqK8Y9jfBRTNR+326 gG5ys/cXyuhgh93yeLs0f8uBAiKYR52GyiRhjpG08IAUMUJCkVaE6KuhdrLS6XSzL+o2vvnAuePix qzgK7qsL79ZqMK2C6S2vtLVYUBV6PR0gp8eGZfWp+27ZJr/n+5Jj4i/+hrusgs2zydjHTBvkltNZ35 y7u07EKmmMVNMfiBH0CJpajwD/aBoEAAAAASUVORK5CYII=""" update() class LocalisationFile(object): """ Defining an objekt which contains all string variables for localisation and initialisates them once. """ SemaphorGerman = False SemaphorEnglish = True stBuEndProgram = "End" stBuColour = "Colour" stBuContrast = "Contrast" stBuLocal = "Local" stBuRemote = "Remote" stBuRefresh = "Refresh" stBuCopyToClipb ="Copy to clipboard" stBuCopyFromClipb ="Copy from clipboard" stLabelSetVoltage1 ="Preset Voltage I" stLabelSetVoltage2 ="Preset Voltage II" stLabelSetVoltage3 ="Preset Voltage III" stLabelSetVoltage4 ="Preset Voltage IV" stLabelSetCurrent1 ="Preset Current I" stLabelSetCurrent2 ="Preset Current II" stLabelSetCurrent3 ="Preset Current III" stLabelSetCurrent4 ="Preset Current IV" stBuChannel1On = "Channel I ON" stBuChannel1Off = "Channel I OFF" stBuChannel2On = "Channel II ON" stBuChannel2Off = "Channel II OFF" stBuChannel3On = "Channel III ON" stBuChannel3Off = "Channel III OFF" stBuChannel4On = "Channel IV ON" stBuChannel4Off = "Channel IV OFF" stPythonVersion = "Python Vers.:" + sys.version[0:8] stLabelForType = "Type of Power Supply: " stLabelForSerialNumber = "Serial No. " stLabelForFirmware = "Firmware: " stBuAllChannelsON = "All Channels ON" stBuAllChannelsOFF = "All Channels OFF" stBuAutoPowerCycleChannel1 = "Power Cycle Reset" stBuRampPower1 = "10Step Ramp up" stBuCoarseStepUpChannel1 = "Step Up" stBuCoarseStepDownChannel1 ="Step Down" stBuSetTo5VChannel1 = "set to 5V" stBuSetTo12VChannel1 = "set to 12V" stBuSetTo24VChannel1 = "set to 24V" stBuSetTo30VChannel1 = "set to 30V" stErrorCOM1 = "No Port COM1" stErrorCOM2 = "No Port COM2" stErrorCOM3 = "No Port COM3" stErrorCOM4 = "No Port COM4" stErrorCOM5 = "No Port COM5" stErrorCOM6 = "No Port COM6" stErrorCOM7 = "No Port COM7" stErrorCOM8 = "No Port COM8" stErrorttyUSB0 = "No Port ttyUSB0" stErrorttyUSB1 = "No Port ttyUSB1" stErrorttyUSB2 = "No Port ttyUSB2" stErrorttyUSB3 = "No Port ttyUSB3" stErrorCOM = "No sutch port or false Port!" stLabelForPythonVersion = "Python Version:" def LocaBritish(): """ Setting the string variables for british localisation. """ LocalisationFile.SemaphorGerman = False LocalisationFile.SemaphorEnglish = True LocalisationFile.stBuEndProgram = "End" LocalisationFile.stBuColour = "Colour" LocalisationFile.stBuLocal = "Local" LocalisationFile.stBuRemote = "Remote" LocalisationFile.stBuContrast = "Contrast" LocalisationFile.stBuRefresh = "Refresh" LocalisationFile.stErrorTitle = "Error!" LocalisationFile.stBuEnd = "End" LocalisationFile.stBuCopyToClipb ="Copy to clipboard" LocalisationFile.stBuCopyFromClipb ="Insert from clipboard" LocalisationFile.stLabelForPythonVersion = Values.stPythonVersion LocalisationFile.stLabelForType = "Type of Power Supply: " + Values.stManufacturer + " " + Values.stType + " " LocalisationFile.stLabelForSerialNumber = "Serial No. " + Values.stSerialnumber LocalisationFile.stLabelForFirmware = "Firmware: " + Values.stFirmwareVersion LocalisationFile.stLabelSetVoltage1 ="Preset Voltage I" LocalisationFile.stLabelSetVoltage2 ="Preset Voltage II" LocalisationFile.stLabelSetVoltage3 ="Preset Voltage III" LocalisationFile.stLabelSetVoltage4 ="Preset Voltage IV" LocalisationFile.stLabelSetCurrent1 ="Preset Current I" LocalisationFile.stLabelSetCurrent2 ="Preset Current II" LocalisationFile.stLabelSetCurrent3 ="Preset Current III" LocalisationFile.stLabelSetCurrent4 ="Preset Current IV" LocalisationFile.stBuChannel1On = "Channel I ON" LocalisationFile.stBuChannel2On = "Channel II ON" LocalisationFile.stBuChannel3On = "Channel III ON" LocalisationFile.stBuChannel4On = "Channel IV ON" LocalisationFile.stBuChannel1Off = "Channel I OFF" LocalisationFile.stBuChannel2Off= "Channel II OFF" LocalisationFile.stBuChannel3Off= "Channel III OFF" LocalisationFile.stBuChannel4Off= "Channel IV OFF" LocalisationFile.stBuAllChannelsON = "All Channels ON" LocalisationFile.stBuAllChannelsOFF = "All Channels OFF" LocalisationFile.stBuAutoPowerCycleChannel1 = "Power Cycle Reset" LocalisationFile.stBuRampPower1 = "10Step Ramp up" LocalisationFile.stBuCoarseStepUpChannel1 = "Step Up" LocalisationFile.stBuCoarseStepDownChannel1 = "Step Down" LocalisationFile.stBuSetTo5VChannel1 = "set to 5V" LocalisationFile.stBuSetTo12VChannel1 = "set to 12V" LocalisationFile.stBuSetTo24VChannel1 = "set to 24V" LocalisationFile.stBuSetTo30VChannel1 = "set to 30V" LocalisationFile.stErrorCOM1 = "No Port COM1!" LocalisationFile.stErrorCOM2 = "No Port COM2!" LocalisationFile.stErrorCOM3 = "No Port COM3!" LocalisationFile.stErrorCOM4 = "No Port COM4!" LocalisationFile.stErrorCOM5 = "No Port COM5!" LocalisationFile.stErrorCOM6 = "No Port COM6!" LocalisationFile.stErrorCOM7 = "No Port COM7!" LocalisationFile.stErrorCOM8 = "No Port COM8!" LocalisationFile.stErrorttyUSB0 = "No Port ttyUSB0!" LocalisationFile.stErrorttyUSB1 = "No Port ttyUSB1!" LocalisationFile.stErrorttyUSB2 = "No Port ttyUSB2!" LocalisationFile.stErrorttyUSB3 = "No Port ttyUSB3!" LocalisationFile.stErrorCOM = "No sutch port or false Port!" update() def LocaGerman(): """ Setting the string variables for german localisation. """ LocalisationFile.SemaphorGerman = True LocalisationFile.SemaphorEnglish = False LocalisationFile.stBuEndProgram = "Ende" LocalisationFile.stBuColour = "Farbe" LocalisationFile.stBuLocal = "Lokal" LocalisationFile.stBuRemote = "Fernbed." LocalisationFile.stBuContrast = "Kontrast" LocalisationFile.stBuRefresh = "Auffrischen" LocalisationFile.stErrorTitle = "Fehler!" LocalisationFile.stBuEnd = "Ende" LocalisationFile.stBuCopyToClipb ="In Zwischenablage kop." LocalisationFile.stBuCopyFromClipb ="Aus Zwischenablage einf." LocalisationFile.stLabelForPythonVersion = Values.stPythonVersion LocalisationFile.stLabelForType = "Typ des Netzteils: " + Values.stManufacturer + " " + Values.stType + " " LocalisationFile.stLabelForSerialNumber = "Serien Nr." + Values.stSerialnumber LocalisationFile.stLabelForFirmware = "Firmware: " + Values.stFirmwareVersion LocalisationFile.stLabelSetVoltage1 ="Voreingestellte Spannung I" LocalisationFile.stLabelSetVoltage2 ="Voreingestellte Spannung II" LocalisationFile.stLabelSetVoltage3 ="Voreingestellte Spannung III" LocalisationFile.stLabelSetVoltage4 ="Voreingestellte Spannung IV" LocalisationFile.stLabelSetCurrent1 ="Voreingestellter Strom I" LocalisationFile.stLabelSetCurrent2 ="Voreingestellter Strom II" LocalisationFile.stLabelSetCurrent3 ="Voreingestellter Strom III" LocalisationFile.stLabelSetCurrent4 ="Voreingestellter Strom IV" LocalisationFile.stBuChannel1On = "Kanal I EIN" LocalisationFile.stBuChannel2On = "Kanal II EIN" LocalisationFile.stBuChannel3On = "Kanal III EIN" LocalisationFile.stBuChannel4On = "Kanal IV EIN" LocalisationFile.stBuChannel1Off = "Kanal I AUS" LocalisationFile.stBuChannel2Off = "Kanal II AUS" LocalisationFile.stBuChannel3Off = "Kanal III AUS" LocalisationFile.stBuChannel4Off = "Kanal IV AUS" LocalisationFile.stBuAllChannelsON = "Alle Kanäle EIN" LocalisationFile.stBuAllChannelsOFF = "Alle Kanäle AUS" LocalisationFile.stBuAutoPowerCycleChannel1 = "EIN-AUS-EIN Reset" LocalisationFile.stBuRampPower1 = "10Schr. Rampe EIN" LocalisationFile.stBuCoarseStepUpChannel1 = "Stufe rauf" LocalisationFile.stBuCoarseStepDownChannel1 ="Stufe runter" LocalisationFile.stBuSetTo5VChannel1 = "Setze zu 5V" LocalisationFile.stBuSetTo12VChannel1 = "Setze zu 12V" LocalisationFile.stBuSetTo24VChannel1 = "Setze zu 24V" LocalisationFile.stBuSetTo30VChannel1 = "Setze zu 30V" LocalisationFile.stErrorCOM1 = "Keine COM1 Schnittstelle!" LocalisationFile.stErrorCOM2 = "Keine COM2 Schnittstelle!" LocalisationFile.stErrorCOM3 = "Keine COM3 Schnittstelle!" LocalisationFile.stErrorCOM4 = "Keine COM4 Schnittstelle!" LocalisationFile.stErrorCOM5 = "Keine COM5 Schnittstelle!" LocalisationFile.stErrorCOM6 = "Keine COM6 Schnittstelle!" LocalisationFile.stErrorCOM7 = "Keine COM7 Schnittstelle!" LocalisationFile.stErrorCOM8 = "Keine COM8 Schnittstelle!" LocalisationFile.stErrorttyUSB0 = "Keine ttyUSB0 Schnittstelle!" LocalisationFile.stErrorttyUSB1 = "Keine ttyUSB1 Schnittstelle!" LocalisationFile.stErrorttyUSB2 = "Keine ttyUSB2 Schnittstelle!" LocalisationFile.stErrorttyUSB3 = "Keine ttyUSB3 Schnittstelle!" LocalisationFile.stErrorCOM = "Schnittstelle existiert nicht oder ist falsch!" update() def update(): """ Updating all window variables for localisation and colour at the window. """ FrameHeader.configure(background = ChangeColoursContrast.stBackground1) SubframeType.configure(background = ChangeColoursContrast.stBackground1) SubframeSerialNumber.configure(background = ChangeColoursContrast.stBackground1) FrameChooseInterface.configure(background = ChangeColoursContrast.stBackground1) FrameCommon.configure(background = ChangeColoursContrast.stBackground1) FrameChannel1.configure(background = ChangeColoursContrast.stBackground1) FrameChannel1Current.configure(background = ChangeColoursContrast.stBackground1) FrameChannel1OnOff.configure(background = ChangeColoursContrast.stBackground1) FrameChannel1Separate.configure(background = ChangeColoursContrast.stBackground1) FrameChannel2.configure(background = ChangeColoursContrast.stBackground1) FrameChannel2Current.configure(background = ChangeColoursContrast.stBackground1) FrameChannel2OnOff.configure(background = ChangeColoursContrast.stBackground1) FrameChannel2Separate.configure(background = ChangeColoursContrast.stBackground1) FrameChannel3.configure(background = ChangeColoursContrast.stBackground1) FrameChannel3Current.configure(background = ChangeColoursContrast.stBackground1) FrameChannel3OnOff.configure(background = ChangeColoursContrast.stBackground1) FrameChannel3Separate.configure(background = ChangeColoursContrast.stBackground1) FrameChannel4.configure(background = ChangeColoursContrast.stBackground1) FrameChannel4Current.configure(background = ChangeColoursContrast.stBackground1) FrameChannel4OnOff.configure(background = ChangeColoursContrast.stBackground1) BuChooseCOM1.configure(background = ChangeColoursContrast.stBackground2) BuChooseCOM1.configure(foreground = ChangeColoursContrast.stForeground1) BuChooseCOM2.configure(background = ChangeColoursContrast.stBackground2) BuChooseCOM2.configure(foreground = ChangeColoursContrast.stForeground1) BuChooseCOM3.configure(background = ChangeColoursContrast.stBackground2) BuChooseCOM3.configure(foreground = ChangeColoursContrast.stForeground1) BuChooseCOM4.configure(background = ChangeColoursContrast.stBackground2) BuChooseCOM4.configure(foreground = ChangeColoursContrast.stForeground1) BuChooseCOM5.configure(background = ChangeColoursContrast.stBackground2) BuChooseCOM5.configure(foreground = ChangeColoursContrast.stForeground1) BuChooseCOM6.configure(background = ChangeColoursContrast.stBackground2) BuChooseCOM6.configure(foreground = ChangeColoursContrast.stForeground1) BuChooseCOM7.configure(background = ChangeColoursContrast.stBackground2) BuChooseCOM7.configure(foreground = ChangeColoursContrast.stForeground1) BuChooseCOM8.configure(background = ChangeColoursContrast.stBackground2) BuChooseCOM8.configure(foreground = ChangeColoursContrast.stForeground1) BuChoosettyUSB0.configure(background = ChangeColoursContrast.stBackground2) BuChoosettyUSB0.configure(foreground = ChangeColoursContrast.stForeground1) BuChoosettyUSB1.configure(background = ChangeColoursContrast.stBackground2) BuChoosettyUSB1.configure(foreground = ChangeColoursContrast.stForeground1) BuChoosettyUSB2.configure(background = ChangeColoursContrast.stBackground2) BuChoosettyUSB2.configure(foreground = ChangeColoursContrast.stForeground1) BuChoosettyUSB3.configure(background = ChangeColoursContrast.stBackground2) BuChoosettyUSB3.configure(foreground = ChangeColoursContrast.stForeground1) BuColour.configure(background = ChangeColoursContrast.stBackground2) BuColour.configure(foreground = ChangeColoursContrast.stForeground1) BuColour.configure(text = LocalisationFile.stBuColour) BuAllChannelsON.configure(background = ChangeColoursContrast.stBackground3) BuAllChannelsON.configure(foreground = ChangeColoursContrast.stForeground1) BuAllChannelsON.configure(text = LocalisationFile.stBuAllChannelsON) BuAllChannelsOFF.configure(background = ChangeColoursContrast.stBackground6) BuAllChannelsOFF.configure(foreground = ChangeColoursContrast.stForeground1) BuAllChannelsOFF.configure(text = LocalisationFile.stBuAllChannelsOFF) BuLocal.configure(background = ChangeColoursContrast.stBackground2) BuLocal.configure(foreground = ChangeColoursContrast.stForeground1) BuLocal.configure(text = LocalisationFile.stBuLocal) BuRefresh.configure(background = ChangeColoursContrast.stBackground2) BuRefresh.configure(foreground = ChangeColoursContrast.stForeground1) BuRefresh.configure(text = LocalisationFile.stBuRefresh) BuRemote.configure(background = ChangeColoursContrast.stBackground2) BuRemote.configure(foreground = ChangeColoursContrast.stForeground1) BuRemote.configure(text = LocalisationFile.stBuRemote) BuContrast.configure(background = ChangeColoursContrast.stBackground2) BuContrast.configure(foreground = ChangeColoursContrast.stForeground1) BuContrast.configure(text = LocalisationFile.stBuContrast) BuEndProgram.configure(background = ChangeColoursContrast.stBackground2) BuEndProgram.configure(foreground = ChangeColoursContrast.stForeground1) BuEndProgram.configure(text = LocalisationFile.stBuEndProgram) BuCopySetVoltage1ToClipb.configure(background = ChangeColoursContrast.stBackground2) BuCopySetVoltage1ToClipb.configure(foreground = ChangeColoursContrast.stForeground1) BuCopySetVoltage1ToClipb.configure(text = LocalisationFile.stBuCopyToClipb) BuCopySetVoltage1FromClipb.configure(background = ChangeColoursContrast.stBackground2) BuCopySetVoltage1FromClipb.configure(foreground = ChangeColoursContrast.stForeground1) BuCopySetVoltage1FromClipb.configure(text = LocalisationFile.stBuCopyFromClipb) BuCopySetVoltage2ToClipb.configure(background = ChangeColoursContrast.stBackground2) BuCopySetVoltage2ToClipb.configure(foreground = ChangeColoursContrast.stForeground1) BuCopySetVoltage2ToClipb.configure(text = LocalisationFile.stBuCopyToClipb) BuCopySetVoltage2FromClipb.configure(background = ChangeColoursContrast.stBackground2) BuCopySetVoltage2FromClipb.configure(foreground = ChangeColoursContrast.stForeground1) BuCopySetVoltage2FromClipb.configure(text = LocalisationFile.stBuCopyFromClipb) BuCopySetVoltage3ToClipb.configure(background = ChangeColoursContrast.stBackground2) BuCopySetVoltage3ToClipb.configure(foreground = ChangeColoursContrast.stForeground1) BuCopySetVoltage3ToClipb.configure(text = LocalisationFile.stBuCopyToClipb) BuCopySetVoltage3FromClipb.configure(background = ChangeColoursContrast.stBackground2) BuCopySetVoltage3FromClipb.configure(foreground = ChangeColoursContrast.stForeground1) BuCopySetVoltage3FromClipb.configure(text = LocalisationFile.stBuCopyFromClipb) BuCopySetVoltage4ToClipb.configure(background = ChangeColoursContrast.stBackground2) BuCopySetVoltage4ToClipb.configure(foreground = ChangeColoursContrast.stForeground1) BuCopySetVoltage4ToClipb.configure(text = LocalisationFile.stBuCopyToClipb) BuCopySetVoltage4FromClipb.configure(background = ChangeColoursContrast.stBackground2) BuCopySetVoltage4FromClipb.configure(foreground = ChangeColoursContrast.stForeground1) BuCopySetVoltage4FromClipb.configure(text = LocalisationFile.stBuCopyFromClipb) LabelForPythonVersion.configure(background = ChangeColoursContrast.stBackground2) LabelForPythonVersion.configure(foreground = ChangeColoursContrast.stForeground1) LabelForPythonVersion.configure(text = LocalisationFile.stLabelForPythonVersion) LabelForType.configure(background = ChangeColoursContrast.stBackground2) LabelForType.configure(foreground = ChangeColoursContrast.stForeground1) LabelForType.configure(text = LocalisationFile.stLabelForType) LabelForSerialNumber.configure(background = ChangeColoursContrast.stBackground2) LabelForSerialNumber.configure(foreground = ChangeColoursContrast.stForeground1) LabelForSerialNumber.configure(text = LocalisationFile.stLabelForSerialNumber) LabelForFirmware.configure(background = ChangeColoursContrast.stBackground2) LabelForFirmware.configure(foreground = ChangeColoursContrast.stForeground1) LabelForFirmware.configure(text = LocalisationFile.stLabelForFirmware) LabelSetVoltage1.configure(background = ChangeColoursContrast.stBackground2) LabelSetVoltage1.configure(foreground = ChangeColoursContrast.stForeground1) LabelSetVoltage1.configure(text = LocalisationFile.stLabelSetVoltage1) LabelSetVoltage2.configure(background = ChangeColoursContrast.stBackground2) LabelSetVoltage2.configure(foreground = ChangeColoursContrast.stForeground1) LabelSetVoltage2.configure(text = LocalisationFile.stLabelSetVoltage2) LabelSetVoltage3.configure(background = ChangeColoursContrast.stBackground2) LabelSetVoltage3.configure(foreground = ChangeColoursContrast.stForeground1) LabelSetVoltage3.configure(text = LocalisationFile.stLabelSetVoltage3) LabelSetVoltage4.configure(background = ChangeColoursContrast.stBackground2) LabelSetVoltage4.configure(foreground = ChangeColoursContrast.stForeground1) LabelSetVoltage4.configure(text = LocalisationFile.stLabelSetVoltage4) EntryChannel1.configure(background = ChangeColoursContrast.stBackground4) EntryChannel1.configure(foreground = ChangeColoursContrast.stForeground2) EntryChannel1.configure(text = Values.stSetVoltage1) EntryChannel2.configure(background = ChangeColoursContrast.stBackground4) EntryChannel2.configure(foreground = ChangeColoursContrast.stForeground2) EntryChannel2.configure(text = Values.stSetVoltage2) EntryChannel3.configure(background = ChangeColoursContrast.stBackground4) EntryChannel3.configure(foreground = ChangeColoursContrast.stForeground2) EntryChannel3.configure(text = Values.stSetVoltage3) EntryChannel4.configure(background = ChangeColoursContrast.stBackground4) EntryChannel4.configure(foreground = ChangeColoursContrast.stForeground2) EntryChannel4.configure(text = Values.stSetVoltage4) LabelSetCurrent1.configure(background = ChangeColoursContrast.stBackground2) LabelSetCurrent1.configure(foreground = ChangeColoursContrast.stForeground1) LabelSetCurrent1.configure(text = LocalisationFile.stLabelSetCurrent1) LabelSetCurrent2.configure(background = ChangeColoursContrast.stBackground2) LabelSetCurrent2.configure(foreground = ChangeColoursContrast.stForeground1) LabelSetCurrent2.configure(text = LocalisationFile.stLabelSetCurrent2) LabelSetCurrent3.configure(background = ChangeColoursContrast.stBackground2) LabelSetCurrent3.configure(foreground = ChangeColoursContrast.stForeground1) LabelSetCurrent3.configure(text = LocalisationFile.stLabelSetCurrent3) LabelSetCurrent4.configure(background = ChangeColoursContrast.stBackground2) LabelSetCurrent4.configure(foreground = ChangeColoursContrast.stForeground1) LabelSetCurrent4.configure(text = LocalisationFile.stLabelSetCurrent4) EntryChannel1Current.configure(background = ChangeColoursContrast.stBackground4) EntryChannel1Current.configure(foreground = ChangeColoursContrast.stForeground2) EntryChannel2Current.configure(background = ChangeColoursContrast.stBackground4) EntryChannel2Current.configure(foreground = ChangeColoursContrast.stForeground2) EntryChannel3Current.configure(background = ChangeColoursContrast.stBackground4) EntryChannel3Current.configure(foreground = ChangeColoursContrast.stForeground2) EntryChannel4Current.configure(background = ChangeColoursContrast.stBackground4) EntryChannel4Current.configure(foreground = ChangeColoursContrast.stForeground2) BuCopySetCurrent1ToClipb.configure(background = ChangeColoursContrast.stBackground2) BuCopySetCurrent1ToClipb.configure(foreground = ChangeColoursContrast.stForeground1) BuCopySetCurrent1ToClipb.configure(text = LocalisationFile.stBuCopyToClipb) BuCopySetCurrent1FromClipb.configure(background = ChangeColoursContrast.stBackground2) BuCopySetCurrent1FromClipb.configure(foreground = ChangeColoursContrast.stForeground1) BuCopySetCurrent1FromClipb.configure(text = LocalisationFile.stBuCopyFromClipb) BuCopySetCurrent2ToClipb.configure(background = ChangeColoursContrast.stBackground2) BuCopySetCurrent2ToClipb.configure(foreground = ChangeColoursContrast.stForeground1) BuCopySetCurrent2ToClipb.configure(text = LocalisationFile.stBuCopyToClipb) BuCopySetCurrent2FromClipb.configure(background = ChangeColoursContrast.stBackground2) BuCopySetCurrent2FromClipb.configure(foreground = ChangeColoursContrast.stForeground1) BuCopySetCurrent2FromClipb.configure(text = LocalisationFile.stBuCopyFromClipb) BuCopySetCurrent3ToClipb.configure(background = ChangeColoursContrast.stBackground2) BuCopySetCurrent3ToClipb.configure(foreground = ChangeColoursContrast.stForeground1) BuCopySetCurrent3ToClipb.configure(text = LocalisationFile.stBuCopyToClipb) BuCopySetCurrent3FromClipb.configure(background = ChangeColoursContrast.stBackground2) BuCopySetCurrent3FromClipb.configure(foreground = ChangeColoursContrast.stForeground1) BuCopySetCurrent3FromClipb.configure(text = LocalisationFile.stBuCopyFromClipb) BuCopySetCurrent4ToClipb.configure(background = ChangeColoursContrast.stBackground2) BuCopySetCurrent4ToClipb.configure(foreground = ChangeColoursContrast.stForeground1) BuCopySetCurrent4ToClipb.configure(text = LocalisationFile.stBuCopyToClipb) BuCopySetCurrent4FromClipb.configure(background = ChangeColoursContrast.stBackground2) BuCopySetCurrent4FromClipb.configure(foreground = ChangeColoursContrast.stForeground1) BuCopySetCurrent4FromClipb.configure(text = LocalisationFile.stBuCopyFromClipb) BuChannel1autoPowerCycle.configure(background = ChangeColoursContrast.stBackground2) BuChannel1autoPowerCycle.configure(foreground = ChangeColoursContrast.stForeground1) BuChannel1autoPowerCycle.configure(text = LocalisationFile.stBuAutoPowerCycleChannel1) BuChannel1RampPower.configure(background = ChangeColoursContrast.stBackground2) BuChannel1RampPower.configure(foreground = ChangeColoursContrast.stForeground1) BuChannel1RampPower.configure(text = LocalisationFile.stBuRampPower1) BuChannel1CoarseStepUp.configure(background = ChangeColoursContrast.stBackground2) BuChannel1CoarseStepUp.configure(foreground = ChangeColoursContrast.stForeground1) BuChannel1CoarseStepUp.configure(text = LocalisationFile.stBuCoarseStepUpChannel1) BuChannel1CoarseStepDown.configure(background = ChangeColoursContrast.stBackground2) BuChannel1CoarseStepDown.configure(foreground = ChangeColoursContrast.stForeground1) BuChannel1CoarseStepDown.configure(text = LocalisationFile.stBuCoarseStepDownChannel1) BuChannel1SetTo5V.configure(background = ChangeColoursContrast.stBackground2) BuChannel1SetTo5V.configure(foreground = ChangeColoursContrast.stForeground1) BuChannel1SetTo5V.configure(text = LocalisationFile.stBuSetTo5VChannel1) BuChannel1SetTo12V.configure(background = ChangeColoursContrast.stBackground2) BuChannel1SetTo12V.configure(foreground = ChangeColoursContrast.stForeground1) BuChannel1SetTo12V.configure(text = LocalisationFile.stBuSetTo12VChannel1) BuChannel1SetTo24V.configure(background = ChangeColoursContrast.stBackground2) BuChannel1SetTo24V.configure(foreground = ChangeColoursContrast.stForeground1) BuChannel1SetTo24V.configure(text = LocalisationFile.stBuSetTo24VChannel1) BuChannel1SetTo30V.configure(background = ChangeColoursContrast.stBackground2) BuChannel1SetTo30V.configure(foreground = ChangeColoursContrast.stForeground1) BuChannel1SetTo30V.configure(text = LocalisationFile.stBuSetTo30VChannel1) IconImageBritish.configure(data = ChangeColoursContrast.IconBritish) IconImageDeutsch.configure(data = ChangeColoursContrast.IconDeutsch) if Values.stSwitchChannel1 == "OFF": BuChannel1OnOff.configure(background = ChangeColoursContrast.stBackground5Off) BuChannel1OnOff.configure(foreground = ChangeColoursContrast.stForeground1) BuChannel1OnOff.configure(text = LocalisationFile.stBuChannel1On) if Values.stSwitchChannel1 == "ON": BuChannel1OnOff.configure(background = ChangeColoursContrast.stBackground5On) BuChannel1OnOff.configure(foreground = ChangeColoursContrast.stForeground1) BuChannel1OnOff.configure(text = LocalisationFile.stBuChannel1Off) if Values.stSwitchChannel2 == "OFF": BuChannel2OnOff.configure(background = ChangeColoursContrast.stBackground5Off) BuChannel2OnOff.configure(foreground = ChangeColoursContrast.stForeground1) BuChannel2OnOff.configure(text = LocalisationFile.stBuChannel2On) if Values.stSwitchChannel2 == "ON": BuChannel2OnOff.configure(background = ChangeColoursContrast.stBackground5On) BuChannel2OnOff.configure(foreground = ChangeColoursContrast.stForeground1) BuChannel2OnOff.configure(text = LocalisationFile.stBuChannel2Off) if Values.stSwitchChannel3 == "OFF": BuChannel3OnOff.configure(background = ChangeColoursContrast.stBackground5Off) BuChannel3OnOff.configure(foreground = ChangeColoursContrast.stForeground1) BuChannel3OnOff.configure(text = LocalisationFile.stBuChannel3On) if Values.stSwitchChannel3 == "ON": BuChannel3OnOff.configure(background = ChangeColoursContrast.stBackground5On) BuChannel3OnOff.configure(foreground = ChangeColoursContrast.stForeground1) BuChannel3OnOff.configure(text = LocalisationFile.stBuChannel3Off) if Values.stSwitchChannel4 == "OFF": BuChannel4OnOff.configure(background = ChangeColoursContrast.stBackground5Off) BuChannel4OnOff.configure(foreground = ChangeColoursContrast.stForeground1) BuChannel4OnOff.configure(text = LocalisationFile.stBuChannel4On) if Values.stSwitchChannel4 == "ON": BuChannel4OnOff.configure(background = ChangeColoursContrast.stBackground5On) BuChannel4OnOff.configure(foreground = ChangeColoursContrast.stForeground1) BuChannel4OnOff.configure(text = LocalisationFile.stBuChannel4Off) #Dummy def Dummy(): print("Dummy aufgerufen") #Dummy-I def DummyI(): print("Dummy-I aufgerufen") #Dummy-II def DummyII(): print("Dummy-II aufgerufen") def RampPowerChannel1(): if Values.stSwitchChannel1 == "OFF": Values.stSwitchChannel1 = "ON" floVoltage1 = float(Values.stSetVoltage1) Step = floVoltage1 / 10 stSendString = ("VSET1:" + "0.000" + "\n") bSendBytes = bytes(stSendString, encoding = "utf-8") stComSend = (bSendBytes) stComReceive = Communication(stComSend) Channel1ON() for index in range(0,11): RampNum = str(Step * index) stSendString = "VSET1:" + RampNum + "\n" EntryChannel1.delete(0,"end") EntryChannel1.insert(25, RampNum + "V") bSendBytes = bytes(stSendString, encoding = "utf-8") stComSend = (bSendBytes) stComReceive = Communication(stComSend) time.sleep(0.5) #SwitchChannel1() # update() BuChannel1OnOff.configure(background = ChangeColoursContrast.stBackground5On) BuChannel1OnOff.configure(foreground = ChangeColoursContrast.stForeground1) BuChannel1OnOff.configure(text = LocalisationFile.stBuChannel1Off) def AutoPowerCycleChannel1(): if Values.stSwitchChannel1 == "ON": Channel1OFF() time.sleep(5) Channel1ON() update() def SwitchChannel1(): Test = False if Values.stSwitchChannel1 == "OFF": Test = True if Values.stSwitchChannel1 == "ON": Test = False if Test == True: Channel1ON() Values.stSwitchChannel1 = "ON" if Test == False: Channel1OFF() Values.stSwitchChannel1 = "OFF" update() def SwitchChannel2(): Test = False if Values.stSwitchChannel2 == "OFF": Test = True if Values.stSwitchChannel2 == "ON": Test = False if Test == True: Channel2ON() Values.stSwitchChannel2 = "ON" if Test == False: Channel2OFF() Values.stSwitchChannel2 = "OFF" update() def SwitchChannel3(): Test = False if Values.stSwitchChannel3 == "OFF": Test = True if Values.stSwitchChannel3 == "ON": Test = False if Test == True: Channel3ON() Values.stSwitchChannel3 = "ON" if Test == False: Channel3OFF() Values.stSwitchChannel3 = "OFF" update() def SwitchChannel4(): Test = False if Values.stSwitchChannel4 == "OFF": Test = True if Values.stSwitchChannel4 == "ON": Test = False if Test == True: Channel4ON() Values.stSwitchChannel4 = "ON" if Test == False: Channel4OFF() Values.stSwitchChannel4 = "OFF" update() def SwitchAllChannelsOFF(): AllChannelsOFF() Values.stSwitchChannel1 = "OFF" Values.stSwitchChannel2 = "OFF" Values.stSwitchChannel3 = "OFF" Values.stSwitchChannel4 = "OFF" update() def SwitchAllChannelsON(): AllChannelsON() Values.stSwitchChannel1 = "ON" Values.stSwitchChannel2 = "ON" Values.stSwitchChannel3 = "ON" Values.stSwitchChannel4 = "ON" update() def ReturnSetVoltage1(Dummy): # Read, to which voltage channel 1 should be set. stlocSetVoltageChannel1 ="" stlocSetVoltageChannel1Num = "" iDecimalcounter = 0 bDecimalmarker = False Values.stSetVoltageChannel1 = EntryChannel1.get() EntryChannel1.delete(0, "end") # Empty Entry, if not, someting strange happens stlocSetVoltageChannel1 = Values.stSetVoltageChannel1 # local Variable while len(stlocSetVoltageChannel1) > 0: stTest = stlocSetVoltageChannel1[:1] if stTest.isdecimal(): stlocSetVoltageChannel1Num = stlocSetVoltageChannel1Num + stTest bDecimalmarker = True if bDecimalmarker == True: if stTest == "." or stTest == ",": stlocSetVoltageChannel1Num = stlocSetVoltageChannel1Num + "." iDecimalcounter = iDecimalcounter + 1 bDecimalmarker = False stlocSetVoltageChannel1 = stlocSetVoltageChannel1[1:] EntryChannel1.delete(0,"end") EntryChannel1.insert(25, stlocSetVoltageChannel1Num + "V") stSendString = "VSET1:" + stlocSetVoltageChannel1Num + "\n" EntryChannel1.insert(25, stlocSetVoltageChannel1Num + "V") bSendBytes = bytes(stSendString, encoding = "utf-8") stComReceive = Communication(bSendBytes) #ActualSets() ActualVoltageSet1() update() # ReturnSetVoltage1 def Channel1StepUp(): # Step Channel 1 up for 1V stlocSetVoltageChannel1 ="" stlocSetVoltageChannel1Num = "" iDecimalcounter = 0 bDecimalmarker = False Values.stSetVoltageChannel1 = EntryChannel1.get() EntryChannel1.delete(0, "end") # Empty Entry, if not, thometing strange happens stlocSetVoltageChannel1 = Values.stSetVoltageChannel1 # local Variable while len(stlocSetVoltageChannel1) > 0: stTest = stlocSetVoltageChannel1[:1] if stTest.isdecimal(): stlocSetVoltageChannel1Num = stlocSetVoltageChannel1Num + stTest bDecimalmarker = True if bDecimalmarker == True: if stTest == "." or stTest == ",": stlocSetVoltageChannel1Num = stlocSetVoltageChannel1Num + "." iDecimalcounter = iDecimalcounter + 1 bDecimalmarker = False stlocSetVoltageChannel1 = stlocSetVoltageChannel1[1:] floSetVoltageChannel1 = float(stlocSetVoltageChannel1Num) floSetVoltageChannel1 = floSetVoltageChannel1 +1 stlocSetVoltageChannel1Num = str(floSetVoltageChannel1) EntryChannel1.delete(0,"end") EntryChannel1.insert(25, stlocSetVoltageChannel1Num + "V") stSendString = "VSET1:" + stlocSetVoltageChannel1Num + "\n" EntryChannel1.insert(25, stlocSetVoltageChannel1Num + "V") bSendBytes = bytes(stSendString, encoding = "utf-8") stComReceive = Communication(bSendBytes) #ActualSets() ActualVoltageSet1() #update() def Channel1StepDown(): # Step Channel 1 down for 1V stlocSetVoltageChannel1 ="" stlocSetVoltageChannel1Num = "" iDecimalcounter = 0 bDecimalmarker = False Values.stSetVoltageChannel1 = EntryChannel1.get() EntryChannel1.delete(0, "end") # Empty Entry, if not, thometing strange happens stlocSetVoltageChannel1 = Values.stSetVoltageChannel1 # local Variable while len(stlocSetVoltageChannel1) > 0: stTest = stlocSetVoltageChannel1[:1] if stTest.isdecimal(): stlocSetVoltageChannel1Num = stlocSetVoltageChannel1Num + stTest bDecimalmarker = True if bDecimalmarker == True: if stTest == "." or stTest == ",": stlocSetVoltageChannel1Num = stlocSetVoltageChannel1Num + "." iDecimalcounter = iDecimalcounter + 1 bDecimalmarker = False stlocSetVoltageChannel1 = stlocSetVoltageChannel1[1:] floSetVoltageChannel1 = float(stlocSetVoltageChannel1Num) floSetVoltageChannel1 = floSetVoltageChannel1 -1 stlocSetVoltageChannel1Num = str(floSetVoltageChannel1) EntryChannel1.delete(0,"end") EntryChannel1.insert(25, stlocSetVoltageChannel1Num + "V") stSendString = "VSET1:" + stlocSetVoltageChannel1Num + "\n" EntryChannel1.insert(25, stlocSetVoltageChannel1Num + "V") bSendBytes = bytes(stSendString, encoding = "utf-8") stComReceive = Communication(bSendBytes) #ActualSets() ActualVoltageSet1() #update() def SetTo5VChanel1(): #Set Channel 1 to 5V stlocSetVoltageChannel1 ="" stlocSetVoltageChannel1Num = "" iDecimalcounter = 0 bDecimalmarker = False Values.stSetVoltageChannel1 ="5V" stlocSetVoltageChannel1 = Values.stSetVoltageChannel1 # local Variable while len(stlocSetVoltageChannel1) > 0: stTest = stlocSetVoltageChannel1[:1] if stTest.isdecimal(): stlocSetVoltageChannel1Num = stlocSetVoltageChannel1Num + stTest bDecimalmarker = True if bDecimalmarker == True: if stTest == "." or stTest == ",": stlocSetVoltageChannel1Num = stlocSetVoltageChannel1Num + "." iDecimalcounter = iDecimalcounter + 1 bDecimalmarker = False stlocSetVoltageChannel1 = stlocSetVoltageChannel1[1:] EntryChannel1.delete(0,"end") EntryChannel1.insert(25, stlocSetVoltageChannel1Num + "V") stSendString = "VSET1:" + stlocSetVoltageChannel1Num + "\n" bSendBytes = bytes(stSendString, encoding = "utf-8") stComSend = bSendBytes stComReceive = Communication(stComSend) ActualVoltageSet1() #ActualSets() update() def SetTo12VChanel1(): #Set Channel 1 to 12V stlocSetVoltageChannel1 ="" stlocSetVoltageChannel1Num = "" iDecimalcounter = 0 bDecimalmarker = False Values.stSetVoltageChannel1 ="12V" stlocSetVoltageChannel1 = Values.stSetVoltageChannel1 # local Variable while len(stlocSetVoltageChannel1) > 0: stTest = stlocSetVoltageChannel1[:1] if stTest.isdecimal(): stlocSetVoltageChannel1Num = stlocSetVoltageChannel1Num + stTest bDecimalmarker = True if bDecimalmarker == True: if stTest == "." or stTest == ",": stlocSetVoltageChannel1Num = stlocSetVoltageChannel1Num + "." iDecimalcounter = iDecimalcounter + 1 bDecimalmarker = False stlocSetVoltageChannel1 = stlocSetVoltageChannel1[1:] EntryChannel1.delete(0,"end") EntryChannel1.insert(25, stlocSetVoltageChannel1Num + "V") stSendString = "VSET1:" + stlocSetVoltageChannel1Num + "\n" bSendBytes = bytes(stSendString, encoding = "utf-8") stComSend = bSendBytes stComReceive = Communication(stComSend) ActualVoltageSet1() #ActualSets() update() def SetTo24VChanel1(): #Set Channel 1 to 24V stlocSetVoltageChannel1 ="" stlocSetVoltageChannel1Num = "" iDecimalcounter = 0 bDecimalmarker = False Values.stSetVoltageChannel1 ="24V" stlocSetVoltageChannel1 = Values.stSetVoltageChannel1 # local Variable while len(stlocSetVoltageChannel1) > 0: stTest = stlocSetVoltageChannel1[:1] if stTest.isdecimal(): stlocSetVoltageChannel1Num = stlocSetVoltageChannel1Num + stTest bDecimalmarker = True if bDecimalmarker == True: if stTest == "." or stTest == ",": stlocSetVoltageChannel1Num = stlocSetVoltageChannel1Num + "." iDecimalcounter = iDecimalcounter + 1 bDecimalmarker = False stlocSetVoltageChannel1 = stlocSetVoltageChannel1[1:] EntryChannel1.delete(0,"end") EntryChannel1.insert(25, stlocSetVoltageChannel1Num + "V") stSendString = "VSET1:" + stlocSetVoltageChannel1Num + "\n" bSendBytes = bytes(stSendString, encoding = "utf-8") stComSend = bSendBytes stComReceive = Communication(stComSend) ActualVoltageSet1() #ActualSets() update() def SetTo30VChanel1(): #Set Channel 1 to 30V stlocSetVoltageChannel1 ="" stlocSetVoltageChannel1Num = "" iDecimalcounter = 0 bDecimalmarker = False Values.stSetVoltageChannel1 ="30V" stlocSetVoltageChannel1 = Values.stSetVoltageChannel1 # local Variable while len(stlocSetVoltageChannel1) > 0: stTest = stlocSetVoltageChannel1[:1] if stTest.isdecimal(): stlocSetVoltageChannel1Num = stlocSetVoltageChannel1Num + stTest bDecimalmarker = True if bDecimalmarker == True: if stTest == "." or stTest == ",": stlocSetVoltageChannel1Num = stlocSetVoltageChannel1Num + "." iDecimalcounter = iDecimalcounter + 1 bDecimalmarker = False stlocSetVoltageChannel1 = stlocSetVoltageChannel1[1:] EntryChannel1.delete(0,"end") EntryChannel1.insert(25, stlocSetVoltageChannel1Num + "V") stSendString = "VSET1:" + stlocSetVoltageChannel1Num + "\n" bSendBytes = bytes(stSendString, encoding = "utf-8") stComSend = bSendBytes stComReceive = Communication(stComSend) ActualVoltageSet1() #ActualSets() update() def ReturnSetVoltage2(Dummy): # Read, to which voltage channel 2 should be set. stlocSetVoltageChannel2 ="" stlocSetVoltageChannel2Num = "" iDecimalcounter = 0 bDecimalmarker = False Values.stSetVoltageChannel2 = EntryChannel2.get() stlocSetVoltageChannel2 = Values.stSetVoltageChannel2 # local Variable while len(stlocSetVoltageChannel2) > 0: stTest = stlocSetVoltageChannel2[:1] if stTest.isdecimal(): stlocSetVoltageChannel2Num = stlocSetVoltageChannel2Num + stTest bDecimalmarker = True if bDecimalmarker == True: if stTest == "." or stTest == ",": stlocSetVoltageChannel2Num = stlocSetVoltageChannel2Num + "." iDecimalcounter = iDecimalcounter + 1 bDecimalmarker = False stlocSetVoltageChannel2 = stlocSetVoltageChannel2[1:] EntryChannel2.delete(0,"end") EntryChannel2.insert(25, stlocSetVoltageChannel2Num + "V") stSendString = "VSET2:" + stlocSetVoltageChannel2Num + "\n" bSendBytes = bytes(stSendString, encoding = "utf-8") stComReceive = Communication(bSendBytes) ActualVoltageSet2() #ActualSets() update() def ReturnSetVoltage3(Dummy): # Read, to which voltage channel 3 should be set. stlocSetVoltageChannel3 ="" stlocSetVoltageChannel3Num = "" iDecimalcounter = 0 bDecimalmarker = False Values.stSetVoltageChannel3 = EntryChannel3.get() stlocSetVoltageChannel3 = Values.stSetVoltageChannel3 # local Variable while len(stlocSetVoltageChannel3) > 0: stTest = stlocSetVoltageChannel3[:1] if stTest.isdecimal(): stlocSetVoltageChannel3Num = stlocSetVoltageChannel3Num + stTest bDecimalmarker = True if bDecimalmarker == True: if stTest == "." or stTest == ",": stlocSetVoltageChannel3Num = stlocSetVoltageChannel3Num + "." iDecimalcounter = iDecimalcounter + 1 bDecimalmarker = False stlocSetVoltageChannel3 = stlocSetVoltageChannel3[1:] EntryChannel3.delete(0,"end") EntryChannel3.insert(25, stlocSetVoltageChannel3Num + "V") stSendString = "VSET3:" + stlocSetVoltageChannel3Num + "\n" bSendBytes = bytes(stSendString, encoding = "utf-8") stComReceive = Communication(bSendBytes) ActualVoltageSet3() #ActualSets() update() def ReturnSetVoltage4(Dummy): # Read, to which voltage channel 4 should be set. stlocSetVoltageChannel4 ="" stlocSetVoltageChannel4Num = "" iDecimalcounter = 0 bDecimalmarker = False Values.stSetVoltageChannel4 = EntryChannel4.get() stlocSetVoltageChannel4 = Values.stSetVoltageChannel4 # local Variable while len(stlocSetVoltageChannel4) > 0: stTest = stlocSetVoltageChannel4[:1] if stTest.isdecimal(): stlocSetVoltageChannel4Num = stlocSetVoltageChannel4Num + stTest bDecimalmarker = True if bDecimalmarker == True: if stTest == "." or stTest == ",": stlocSetVoltageChannel4Num = stlocSetVoltageChannel4Num + "." iDecimalcounter = iDecimalcounter + 1 bDecimalmarker = False stlocSetVoltageChannel4 = stlocSetVoltageChannel4[1:] EntryChannel4.delete(0,"end") EntryChannel4.insert(25, stlocSetVoltageChannel4Num + "V") stSendString = "VSET4:" + stlocSetVoltageChannel4Num + "\n" bSendBytes = bytes(stSendString, encoding = "utf-8") stComReceive = Communication(bSendBytes) ActualVoltageSet4() #ActualSets() update() def ReturnSetCurrent1(Dummy): # Read, to which current channel 1 should be set. stlocSetCurrentChannel1 ="" stlocSetCurrentChannel1Num = "" iDecimalcounter = 0 bDecimalmarker = False Values.stSetCurrentChannel1 = EntryChannel1Current.get() stlocSetCurrentChannel1 = Values.stSetCurrentChannel1 # local Variable while len(stlocSetCurrentChannel1) > 0: stTest = stlocSetCurrentChannel1[:1] if stTest.isdecimal(): stlocSetCurrentChannel1Num = stlocSetCurrentChannel1Num + stTest bDecimalmarker = True if bDecimalmarker == True: if stTest == "." or stTest == ",": stlocSetCurrentChannel1Num = stlocSetCurrentChannel1Num + "." iDecimalcounter = iDecimalcounter + 1 bDecimalmarker = False stlocSetCurrentChannel1 = stlocSetCurrentChannel1[1:] EntryChannel1Current.delete(0,"end") EntryChannel1Current.insert(25, stlocSetCurrentChannel1Num + "A") stSendString = "ISET1:" + stlocSetCurrentChannel1Num + "\n" bSendBytes = bytes(stSendString, encoding = "utf-8") stComReceive = Communication(bSendBytes) ActualCurrentSet1() update() def ReturnSetCurrent2(Dummy): # Read, to which current channel 2 should be set. stlocSetCurrentChannel2 ="" stlocSetCurrentChannel2Num = "" iDecimalcounter = 0 bDecimalmarker = False Values.stSetCurrentChannel2 = EntryChannel2Current.get() stlocSetCurrentChannel2 = Values.stSetCurrentChannel2 # local Variable while len(stlocSetCurrentChannel2) > 0: stTest = stlocSetCurrentChannel2[:1] if stTest.isdecimal(): stlocSetCurrentChannel2Num = stlocSetCurrentChannel2Num + stTest bDecimalmarker = True if bDecimalmarker == True: if stTest == "." or stTest == ",": stlocSetCurrentChannel2Num = stlocSetCurrentChannel2Num + "." iDecimalcounter = iDecimalcounter + 1 bDecimalmarker = False stlocSetCurrentChannel2 = stlocSetCurrentChannel2[1:] EntryChannel2Current.delete(0,"end") EntryChannel2Current.insert(25, stlocSetCurrentChannel2Num + "A") stSendString = "ISET2:" + stlocSetCurrentChannel2Num + "\n" bSendBytes = bytes(stSendString, encoding = "utf-8") stComReceive = Communication(bSendBytes) ActualCurrentSet2() update() def ReturnSetCurrent3(Dummy): # Read, to which current channel 3 should be set. stlocSetCurrentChannel3 ="" stlocSetCurrentChannel3Num = "" iDecimalcounter = 0 bDecimalmarker = False Values.stSetCurrentChannel3 = EntryChannel3Current.get() stlocSetCurrentChannel3 = Values.stSetCurrentChannel3 # local Variable while len(stlocSetCurrentChannel3) > 0: stTest = stlocSetCurrentChannel3[:1] if stTest.isdecimal(): stlocSetCurrentChannel3Num = stlocSetCurrentChannel3Num + stTest bDecimalmarker = True if bDecimalmarker == True: if stTest == "." or stTest == ",": stlocSetCurrentChannel3Num = stlocSetCurrentChannel3Num + "." iDecimalcounter = iDecimalcounter + 1 bDecimalmarker = False stlocSetCurrentChannel3 = stlocSetCurrentChannel3[1:] EntryChannel3Current.delete(0,"end") EntryChannel3Current.insert(25, stlocSetCurrentChannel3Num + "A") stSendString = "ISET3:" + stlocSetCurrentChannel3Num + "\n" bSendBytes = bytes(stSendString, encoding = "utf-8") stComReceive = Communication(bSendBytes) ActualCurrentSet3() update() def ReturnSetCurrent4(Dummy): # Read, to which current channel 3 should be set. stlocSetCurrentChannel4 ="" stlocSetCurrentChannel4Num = "" iDecimalcounter = 0 bDecimalmarker = False Values.stSetCurrentChannel4 = EntryChannel4Current.get() stlocSetCurrentChannel4 = Values.stSetCurrentChannel4 # local Variable while len(stlocSetCurrentChannel4) > 0: stTest = stlocSetCurrentChannel4[:1] if stTest.isdecimal(): stlocSetCurrentChannel4Num = stlocSetCurrentChannel4Num + stTest bDecimalmarker = True if bDecimalmarker == True: if stTest == "." or stTest == ",": stlocSetCurrentChannel4Num = stlocSetCurrentChannel4Num + "." iDecimalcounter = iDecimalcounter + 1 bDecimalmarker = False stlocSetCurrentChannel4 = stlocSetCurrentChannel4[1:] EntryChannel4Current.delete(0,"end") EntryChannel4Current.insert(25, stlocSetCurrentChannel4Num + "A") stSendString = "ISET4:" + stlocSetCurrentChannel4Num + "\n" bSendBytes = bytes(stSendString, encoding = "utf-8") stComReceive = Communication(bSendBytes) ActualCurrentSet4() update() def SetToCOM1(): Values.stSerialChannelName = "COM1" try: Refresh() except serial.SerialException: #antwort = b'IO ERROR ,E R R O R,SN:none\n' print("no IO port No.1 ") tkinter.messagebox.showerror("Error", LocalisationFile.stErrorCOM1) antwort = b'IO ERROR ,E R R O R,SN:none\n' exit else: Refresh() def SetToCOM2(): Values.stSerialChannelName = "COM2" try: Refresh() except serial.SerialException: antwort = "" #b'IO ERROR ,E R R O R,SN:none\n' print("no IO port No.2") tkinter.messagebox.showerror("Error", LocalisationFile.stErrorCOM2) exit else: Refresh() def SetToCOM3(): Values.stSerialChannelName = "COM3" try: Refresh() except serial.SerialException: antwort = "" #b'IO ERROR ,E R R O R,SN:none\n' print("no IO port No.3") tkinter.messagebox.showerror("Error", LocalisationFile.stErrorCOM3) exit else: Refresh() def SetToCOM4(): Values.stSerialChannelName = "COM4" try: Refresh() except serial.SerialException: antwort = "" #b'IO ERROR ,E R R O R,SN:none\n' print("no IO port No.4") tkinter.messagebox.showerror("Error", LocalisationFile.stErrorCOM4) #antwort = b'IO ERROR ,E R R O R,SN:none\n' exit else: Refresh() def SetToCOM5(): Values.stSerialChannelName = "COM5" try: Refresh() except serial.SerialException: antwort = "" #b'IO ERROR ,E R R O R,SN:none\n' print("no IO port No.5") tkinter.messagebox.showerror("Error", LocalisationFile.stErrorCOM5) #antwort = b'IO ERROR ,E R R O R,SN:none\n' exit else: Refresh() def SetToCOM6(): Values.stSerialChannelName = "COM6" try: Refresh() except serial.SerialException: antwort = "" #b'IO ERROR ,E R R O R,SN:none\n' print("no IO port No.6") tkinter.messagebox.showerror("Error", LocalisationFile.stErrorCOM6) #antwort = b'IO ERROR ,E R R O R,SN:none\n' exit else: Refresh() def SetToCOM7(): Values.stSerialChannelName = "COM7" try: Refresh() except serial.SerialException: antwort = "" #b'IO ERROR ,E R R O R,SN:none\n' print("no IO port No.7") tkinter.messagebox.showerror("Error", LocalisationFile.stErrorCOM7) #antwort = b'IO ERROR ,E R R O R,SN:none\n' exit else: Refresh() def SetToCOM8(): Values.stSerialChannelName = "COM8" try: Refresh() except serial.SerialException: antwort = "" #b'IO ERROR ,E R R O R,SN:none\n' print("no IO port No.8") tkinter.messagebox.showerror("Error", LocalisationFile.stErrorCOM8) #antwort = b'IO ERROR ,E R R O R,SN:none\n' exit else: Refresh() def SetTottyUSB0(): Values.stSerialChannelName = "ttyUSB0" try: Refresh() except serial.SerialException: antwort = "" #b'IO ERROR ,E R R O R,SN:none\n' print("no IO port ttyUSB0") tkinter.messagebox.showerror("Error", LocalisationFile.stErrorttyUSB0) #antwort = b'IO ERROR ,E R R O R,SN:none\n' exit else: Refresh() def SetTottyUSB1(): Values.stSerialChannelName = "ttyUSB1" try: Refresh() except serial.SerialException: antwort = "" #b'IO ERROR ,E R R O R,SN:none\n' print("no IO port ttyUSB1") tkinter.messagebox.showerror("Error", LocalisationFile.stErrorttyUSB1) #antwort = b'IO ERROR ,E R R O R,SN:none\n' exit else: Refresh() def SetTottyUSB2(): Values.stSerialChannelName = "ttyUSB2" try: Refresh() except serial.SerialException: antwort = "" #b'IO ERROR ,E R R O R,SN:none\n' print("no IO port ttyUSB2") tkinter.messagebox.showerror("Error", LocalisationFile.stErrorttyUSB2) #antwort = b'IO ERROR ,E R R O R,SN:none\n' exit else: Refresh() def SetTottyUSB3(): Values.stSerialChannelName = "ttyUSB3" try: Refresh() except serial.SerialException: antwort = "" #b'IO ERROR ,E R R O R,SN:none\n' print("no IO port ttyUSB3") tkinter.messagebox.showerror("Error", LocalisationFile.stErrorttyUSB3) #antwort = b'IO ERROR ,E R R O R,SN:none\n' exit else: Refresh() def CopyVoltChanel1toClipb(): Mainwindow.clipboard_clear() #First: clear clipboard! Mainwindow.clipboard_append(EntryChannel1.get()) #second: Write value to clipboard! def CopyVoltChanel2toClipb(): Mainwindow.clipboard_clear() #First: clear clipboard! Mainwindow.clipboard_append(EntryChannel2.get()) #second: Write value to clipboard! def CopyVoltChanel3toClipb(): Mainwindow.clipboard_clear() #First: clear clipboard! Mainwindow.clipboard_append(EntryChannel3.get()) #second: Write value to clipboard! def CopyVoltChanel4toClipb(): Mainwindow.clipboard_clear() #First: clear clipboard! Mainwindow.clipboard_append(EntryChannel4.get()) #second: Write value to clipboard! def CopyCurrentChanel1CurrentToClipb(): Mainwindow.clipboard_clear() #First: clear clipboard! Mainwindow.clipboard_append(EntryChannel1Current.get()) #second: Write value to clipboard! def CopyCurrentChanel2CurrentToClipb(): Mainwindow.clipboard_clear() #First: clear clipboard! Mainwindow.clipboard_append(EntryChannel2Current.get()) #second: Write value to clipboard! def CopyCurrentChanel3CurrentToClipb(): Mainwindow.clipboard_clear() #First: clear clipboard! Mainwindow.clipboard_append(EntryChannel3Current.get()) #second: Write value to clipboard! def CopyCurrentChanel4CurrentToClipb(): Mainwindow.clipboard_clear() #First: clear clipboard! Mainwindow.clipboard_append(EntryChannel4Current.get()) #second: Write value to clipboard! def InsertClipboardIntoSetCurrentChanel1(): stlocSetCurrentChannel1 ="" stlocSetCurrentChannel1Num = "" iDecimalcounter = 0 bDecimalmarker = False Values.stSetCurrentChannel1 =Mainwindow.clipboard_get() stlocSetCurrentChannel1 = Values.stSetCurrentChannel1 # local Variable while len(stlocSetCurrentChannel1) > 0: stTest = stlocSetCurrentChannel1[:1] if stTest.isdecimal(): stlocSetCurrentChannel1Num = stlocSetCurrentChannel1Num + stTest bDecimalmarker = True if bDecimalmarker == True: if stTest == "." or stTest == ",": stlocSetCurrentChannel1Num = stlocSetCurrentChannel1Num + "." iDecimalcounter = iDecimalcounter + 1 bDecimalmarker = False stlocSetCurrentChannel1 = stlocSetCurrentChannel1[1:] EntryChannel1Current.delete(0,"end") EntryChannel1Current.insert(25, stlocSetCurrentChannel1Num + "A") stSendString = "ISET1:" + stlocSetCurrentChannel1Num + "\n" bSendBytes = bytes(stSendString, encoding = "utf-8") stComReceive = Communication(bSendBytes) ActualCurrentSet1() #ActualSets() #update() def InsertClipboardIntoSetCurrentChanel2(): stlocSetCurrentChannel2 ="" stlocSetCurrentChannel2Num = "" iDecimalcounter = 0 bDecimalmarker = False Values.stSetCurrentChannel2 =Mainwindow.clipboard_get() stlocSetCurrentChannel2 = Values.stSetCurrentChannel2 # local Variable while len(stlocSetCurrentChannel2) > 0: stTest = stlocSetCurrentChannel2[:1] if stTest.isdecimal(): stlocSetCurrentChannel2Num = stlocSetCurrentChannel2Num + stTest bDecimalmarker = True if bDecimalmarker == True: if stTest == "." or stTest == ",": stlocSetCurrentChannel2Num = stlocSetCurrentChannel2Num + "." iDecimalcounter = iDecimalcounter + 1 bDecimalmarker = False stlocSetCurrentChannel2 = stlocSetCurrentChannel2[1:] EntryChannel2Current.delete(0,"end") EntryChannel2Current.insert(25, stlocSetCurrentChannel2Num + "A") stSendString = "ISET2:" + stlocSetCurrentChannel2Num + "\n" bSendBytes = bytes(stSendString, encoding = "utf-8") stComReceive = Communication(bSendBytes) ActualCurrentSet2() #ActualSets() #update() def InsertClipboardIntoSetCurrentChanel3(): stlocSetCurrentChannel3 ="" stlocSetCurrentChannel3Num = "" iDecimalcounter = 0 bDecimalmarker = False Values.stSetCurrentChannel3 =Mainwindow.clipboard_get() stlocSetCurrentChannel3 = Values.stSetCurrentChannel3 # local Variable while len(stlocSetCurrentChannel3) > 0: stTest = stlocSetCurrentChannel3[:1] if stTest.isdecimal(): stlocSetCurrentChannel3Num = stlocSetCurrentChannel3Num + stTest bDecimalmarker = True if bDecimalmarker == True: if stTest == "." or stTest == ",": stlocSetCurrentChannel3Num = stlocSetCurrentChannel3Num + "." iDecimalcounter = iDecimalcounter + 1 bDecimalmarker = False stlocSetCurrentChannel3 = stlocSetCurrentChannel3[1:] EntryChannel3Current.delete(0,"end") EntryChannel3Current.insert(25, stlocSetCurrentChannel3Num + "A") stSendString = "ISET3:" + stlocSetCurrentChannel3Num + "\n" bSendBytes = bytes(stSendString, encoding = "utf-8") stComReceive = Communication(bSendBytes) ActualCurrentSet3() #ActualSets() #update() def InsertClipboardIntoSetCurrentChanel4(): stlocSetCurrentChannel4 ="" stlocSetCurrentChannel4Num = "" iDecimalcounter = 0 bDecimalmarker = False Values.stSetCurrentChannel4 =Mainwindow.clipboard_get() stlocSetCurrentChannel4 = Values.stSetCurrentChannel4 # local Variable while len(stlocSetCurrentChannel4) > 0: stTest = stlocSetCurrentChannel4[:1] if stTest.isdecimal(): stlocSetCurrentChannel4Num = stlocSetCurrentChannel4Num + stTest bDecimalmarker = True if bDecimalmarker == True: if stTest == "." or stTest == ",": stlocSetCurrentChannel4Num = stlocSetCurrentChannel4Num + "." iDecimalcounter = iDecimalcounter + 1 bDecimalmarker = False stlocSetCurrentChannel4 = stlocSetCurrentChannel4[1:] EntryChannel4Current.delete(0,"end") EntryChannel4Current.insert(25, stlocSetCurrentChannel4Num + "A") stSendString = "ISET4:" + stlocSetCurrentChannel4Num + "\n" bSendBytes = bytes(stSendString, encoding = "utf-8") stComReceive = Communication(bSendBytes) ActualCurrentSet4() #ActualSets() #update() def InsertClipboardIntoSetVoltageChanel1(): stlocSetVoltageChannel1 ="" stlocSetVoltageChannel1Num = "" iDecimalcounter = 0 bDecimalmarker = False Values.stSetVoltageChannel1 =Mainwindow.clipboard_get() stlocSetVoltageChannel1 = Values.stSetVoltageChannel1 # local Variable while len(stlocSetVoltageChannel1) > 0: stTest = stlocSetVoltageChannel1[:1] if stTest.isdecimal(): stlocSetVoltageChannel1Num = stlocSetVoltageChannel1Num + stTest bDecimalmarker = True if bDecimalmarker == True: if stTest == "." or stTest == ",": stlocSetVoltageChannel1Num = stlocSetVoltageChannel1Num + "." iDecimalcounter = iDecimalcounter + 1 bDecimalmarker = False stlocSetVoltageChannel1 = stlocSetVoltageChannel1[1:] EntryChannel1.delete(0,"end") EntryChannel1.insert(25, stlocSetVoltageChannel1Num + "V") stSendString = "VSET1:" + stlocSetVoltageChannel1Num + "\n" bSendBytes = bytes(stSendString, encoding = "utf-8") stComSend = bSendBytes stComReceive = Communication(stComSend) ActualVoltageSet1() #ActualSets() #update() def InsertClipboardIntoSetVoltageChanel2(): stlocSetVoltageChannel2 ="" stlocSetVoltageChannel2Num = "" iDecimalcounter = 0 bDecimalmarker = False Values.stSetVoltageChannel2 =Mainwindow.clipboard_get() stlocSetVoltageChannel2 = Values.stSetVoltageChannel2 # local Variable while len(stlocSetVoltageChannel2) > 0: stTest = stlocSetVoltageChannel2[:1] if stTest.isdecimal(): stlocSetVoltageChannel2Num = stlocSetVoltageChannel2Num + stTest bDecimalmarker = True if bDecimalmarker == True: if stTest == "." or stTest == ",": stlocSetVoltageChannel2Num = stlocSetVoltageChannel2Num + "." iDecimalcounter = iDecimalcounter + 1 bDecimalmarker = False stlocSetVoltageChannel2 = stlocSetVoltageChannel2[1:] EntryChannel2.delete(0,"end") EntryChannel2.insert(25, stlocSetVoltageChannel2Num + "V") stSendString = "VSET2:" + stlocSetVoltageChannel2Num + "\n" bSendBytes = bytes(stSendString, encoding = "utf-8") stComSend = bSendBytes stComReceive = Communication(stComSend) ActualVoltageSet2() #ActualSets() #update() def InsertClipboardIntoSetVoltageChanel3(): stlocSetVoltageChannel3 ="" stlocSetVoltageChannel3Num = "" iDecimalcounter = 0 bDecimalmarker = False Values.stSetVoltageChannel3 =Mainwindow.clipboard_get() stlocSetVoltageChannel3 = Values.stSetVoltageChannel3 # local Variable while len(stlocSetVoltageChannel3) > 0: stTest = stlocSetVoltageChannel3[:1] if stTest.isdecimal(): stlocSetVoltageChannel3Num = stlocSetVoltageChannel3Num + stTest bDecimalmarker = True if bDecimalmarker == True: if stTest == "." or stTest == ",": stlocSetVoltageChannel3Num = stlocSetVoltageChannel3Num + "." iDecimalcounter = iDecimalcounter + 1 bDecimalmarker = False stlocSetVoltageChannel3 = stlocSetVoltageChannel3[1:] EntryChannel3.delete(0,"end") EntryChannel3.insert(25, stlocSetVoltageChannel3Num + "V") stSendString = "VSET3:" + stlocSetVoltageChannel3Num + "\n" bSendBytes = bytes(stSendString, encoding = "utf-8") stComSend = bSendBytes stComReceive = Communication(stComSend) ActualVoltageSet3() #ActualSets() #update() def InsertClipboardIntoSetVoltageChanel4(): stlocSetVoltageChannel4 ="" stlocSetVoltageChannel4Num = "" iDecimalcounter = 0 bDecimalmarker = False Values.stSetVoltageChannel4 =Mainwindow.clipboard_get() stlocSetVoltageChannel4 = Values.stSetVoltageChannel4 # local Variable while len(stlocSetVoltageChannel4) > 0: stTest = stlocSetVoltageChannel4[:1] if stTest.isdecimal(): stlocSetVoltageChannel4Num = stlocSetVoltageChannel4Num + stTest bDecimalmarker = True if bDecimalmarker == True: if stTest == "." or stTest == ",": stlocSetVoltageChannel4Num = stlocSetVoltageChannel4Num + "." iDecimalcounter = iDecimalcounter + 1 bDecimalmarker = False stlocSetVoltageChannel4 = stlocSetVoltageChannel4[1:] EntryChannel4.delete(0,"end") EntryChannel4.insert(25, stlocSetVoltageChannel4Num + "V") stSendString = "VSET4:" + stlocSetVoltageChannel4Num + "\n" bSendBytes = bytes(stSendString, encoding = "utf-8") stComSend = bSendBytes stComReceive = Communication(stComSend) ActualVoltageSet4() #ActualSets() #update() # Funktion End Programm def EndProgram(): Mainwindow.destroy() # Ruft alle Abfragen auf def Refresh(): TypeSeriennummer() ActualChannelStatus() ActualSets() update() # queries channel Status def ActualChannelStatus(): #interfacedefinition = serial.Serial(Values.stSerialChannelName, 115200, timeout=1) antwort = "" #Damit eine Antwort existiert, wenn keine kommt. #if not interfacedefinition.isOpen(): #interfacedefinition.open() #interfacedefinition.flushInput() try: antwort = Communication(b'output1:state?\n') # Liest den AN/Aus Status auf Kanal 1. # interfacedefinition.write(b'output1:state?\n') # Liest den AN/Aus Status auf Kanal 1. #interfacedefinition.flushInput() #antwort = interfacedefinition.read(50) #interfacedefinition.close() except serial.SerialException: antwort = b'IO ERROR ,E R R O R,SN:none\n' print("no IO port Test ") tkinter.messagebox.showerror("Error", "COM Port Error") Decodetantwort=antwort.decode("utf-8") if Decodetantwort == "ON\n": Values.stSwitchChannel1 = "ON" if Decodetantwort == "OFF\n": Values.stSwitchChannel1 = "OFF" #interfacedefinition = serial.Serial(Values.stSerialChannelName, 115200, timeout=1) antwort = "" #Damit eine Antwort existiert, wenn keine kommt. #if not interfacedefinition.isOpen(): # interfacedefinition.open() #interfacedefinition.flushInput() try: antwort = Communication(b'output2:state?\n') # Liest den AN/Aus Status auf Kanal 2. #interfacedefinition.write(b'output2:state?\n') # Liest den AN/Aus Status auf Kanal 2. #interfacedefinition.flushInput() #antwort = interfacedefinition.read(50) #interfacedefinition.close() except serial.SerialException: antwort = b'IO ERROR ,E R R O R,SN:none\n' print("no IO port Test ") tkinter.messagebox.showerror("Error", "COM Port Error") Decodetantwort=antwort.decode("utf-8") if Decodetantwort == "ON\n": Values.stSwitchChannel2 = "ON" if Decodetantwort == "OFF\n": Values.stSwitchChannel2 = "OFF" #interfacedefinition = serial.Serial(Values.stSerialChannelName, 115200, timeout=1) #if not interfacedefinition.isOpen(): # interfacedefinition.open() #interfacedefinition.flushInput() #interfacedefinition.write(b'output3:state?\n') # Liest den AN/Aus Status auf Kanal 3. #interfacedefinition.flushInput() #antwort = interfacedefinition.read(50) #interfacedefinition.close() antwort = "" #Damit eine Antwort existiert, wenn keine kommt. try: antwort = Communication(b'output3:state?\n') # Liest den AN/Aus Status auf Kanal 3. except serial.SerialException: antwort = b'IO ERROR ,E R R O R,SN:none\n' print("no IO port Test ") tkinter.messagebox.showerror("Error", "COM Port Error") Decodetantwort=antwort.decode("utf-8") if Decodetantwort == "ON\n": Values.stSwitchChannel3 = "ON" if Decodetantwort == "OFF\n": Values.stSwitchChannel3 = "OFF" #interfacedefinition = serial.Serial(Values.stSerialChannelName, 115200, timeout=1) #if not interfacedefinition.isOpen(): # interfacedefinition.open() #interfacedefinition.flushInput() #interfacedefinition.write(b'output4:state?\n') # Liest den AN/Aus Status auf Kanal 4. #interfacedefinition.flushInput() #antwort = interfacedefinition.read(50) #interfacedefinition.close() antwort = "" #Damit eine Antwort existiert, wenn keine kommt. try: antwort = Communication(b'output4:state?\n') # Liest den AN/Aus Status auf Kanal 4. except serial.SerialException: antwort = b'IO ERROR ,E R R O R,SN:none\n' print("no IO port Test ") tkinter.messagebox.showerror("Error", "COM Port Error") Decodetantwort=antwort.decode("utf-8") if Decodetantwort == "ON\n": Values.stSwitchChannel4 = "ON" if Decodetantwort == "OFF\n": Values.stSwitchChannel4 = "OFF" update() # Queries actual presetted voltages/currents def ActualSets(): ActualVoltageSet1() ActualCurrentSet1() ActualVoltageSet2() ActualCurrentSet2() ActualVoltageSet3() ActualCurrentSet3() ActualVoltageSet4() ActualCurrentSet4() # Queries actual presetted voltages/currents def ActualVoltageSet1(): stComReceive = Communication(b'VSET1?\n') antwort = stComReceive stSetVoltage1 = str(antwort) iLaenge = len(stSetVoltage1) iPosEnde = iLaenge - 3 Values.stSetVoltage1 = stSetVoltage1[2:iPosEnde] EntryChannel1.delete(0,"end") EntryChannel1.insert(25,Values.stSetVoltage1 + "V") #update() def ActualVoltageSet2(): stComReceive = Communication(b'VSET2?\n') antwort = stComReceive stSetVoltage2 = str(antwort) iLaenge = len(stSetVoltage2) iPosEnde = iLaenge - 3 Values.stSetVoltage2 = stSetVoltage2[2:iPosEnde] EntryChannel2.delete(0,"end") EntryChannel2.insert(25,Values.stSetVoltage2 + "V") #update() def ActualVoltageSet3(): stComReceive = Communication(b'VSET3?\n') antwort = stComReceive stSetVoltage3 = str(antwort) iLaenge = len(stSetVoltage3) iPosEnde = iLaenge - 3 Values.stSetVoltage3 = stSetVoltage3[2:iPosEnde] EntryChannel3.delete(0,"end") EntryChannel3.insert(25,Values.stSetVoltage3 + "V") #update() def ActualVoltageSet4(): stComReceive = Communication(b'VSET4?\n') antwort = stComReceive stSetVoltage4 = str(antwort) iLaenge = len(stSetVoltage4) iPosEnde = iLaenge - 3 Values.stSetVoltage4 = stSetVoltage4[2:iPosEnde] EntryChannel4.delete(0,"end") EntryChannel4.insert(25,Values.stSetVoltage4 + "V") #update() # Queries actual presetted currents def ActualCurrentSet1(): stComReceive = Communication(b'ISET1?\n') antwort = stComReceive stSetCurrent1 = str(antwort) iLaenge = len(stSetCurrent1) iPosEnde = iLaenge - 3 Values.stSetCurrent1 = stSetCurrent1[2:iPosEnde] EntryChannel1Current.delete(0,"end") EntryChannel1Current.insert(25,Values.stSetCurrent1 + "A") #update() def ActualCurrentSet2(): stComReceive = Communication(b'ISET2?\n') antwort = stComReceive stSetCurrent2 = str(antwort) iLaenge = len(stSetCurrent2) iPosEnde = iLaenge - 3 Values.stSetCurrent2 = stSetCurrent2[2:iPosEnde] EntryChannel2Current.delete(0,"end") EntryChannel2Current.insert(25,Values.stSetCurrent2 + "A") #update() def ActualCurrentSet3(): stComReceive = Communication(b'ISET3?\n') antwort = stComReceive stSetCurrent3 = str(antwort) iLaenge = len(stSetCurrent3) iPosEnde = iLaenge - 3 Values.stSetCurrent3 = stSetCurrent3[2:iPosEnde] EntryChannel3Current.delete(0,"end") EntryChannel3Current.insert(25,Values.stSetCurrent3 + "A") #update() def ActualCurrentSet4(): stComReceive = Communication(b'ISET4?\n') antwort = stComReceive stSetCurrent4 = str(antwort) iLaenge = len(stSetCurrent4) iPosEnde = iLaenge - 3 Values.stSetCurrent4 = stSetCurrent4[2:iPosEnde] EntryChannel4Current.delete(0,"end") EntryChannel4Current.insert(25,Values.stSetCurrent4 + "A") #update() # Mainwindow Mainwindow = tkinter.Tk() Mainwindow.title ("GWInstekPowerSupply-GPP-4323_GUI-Kommunikation_Rev8-0_26Nov2024.py") IconImageBritish=tkinter.PhotoImage(master = Mainwindow, data=ChangeColoursContrast.IconBritish) IconImageDeutsch=tkinter.PhotoImage(master = Mainwindow, data=ChangeColoursContrast.IconDeutsch) # Header, for Type, Serial numbers, Firmware FrameHeader = tkinter.Frame(Mainwindow, height = 10, width = 30, background = "#002040") # background = #002040 is dark blue FrameHeader.pack(side = tkinter.TOP, fill = tkinter.X) # FrameChooseInterface FrameChooseInterface = tkinter.Frame(Mainwindow, height = 35, width = 60, background = "#002040") # background = #002040 is dark blue FrameChooseInterface.pack(side = tkinter.TOP, fill = tkinter.X) # Common FrameCommon =tkinter.Frame(Mainwindow, height = 35, width = 60, background = "#002040") # background = #002040 is dark blue FrameCommon.pack(side = tkinter.TOP, fill =tkinter.X) # Channel-I FrameChannel1 = tkinter.Frame(Mainwindow, height = 30, width = 30, background = "#002040") # background = #002040 is dark blue FrameChannel1.pack(side = tkinter.TOP, fill = tkinter.X) # Channel-I-Current FrameChannel1Current = tkinter.Frame(Mainwindow, height = 30, width = 30, background = "#002040") # background = #002040 is dark blue FrameChannel1Current.pack(side = tkinter.TOP, fill = tkinter.X) # Channel-I-On/OFF FrameChannel1OnOff = tkinter.Frame(Mainwindow, height = 30, width = 30, background = "#002040") # background = #002040 is dark blue FrameChannel1OnOff.pack(side = tkinter.TOP, fill = tkinter.X) # Channel-I-Separate FrameChannel1Separate = tkinter.Frame(Mainwindow, height = 10, width = 30, background = "#002040") # background = #002040 is dark blue FrameChannel1Separate.pack(side = tkinter.TOP, fill = tkinter.X) # Channel-II FrameChannel2 = tkinter.Frame(Mainwindow, height = 30, width = 30, background = "#002040") # background = #002040 is dark blue FrameChannel2.pack(side = tkinter.TOP, fill = tkinter.X) # Channel-II-Current FrameChannel2Current = tkinter.Frame(Mainwindow, height = 30, width = 30, background = "#002040") # background = #002040 is dark blue FrameChannel2Current.pack(side = tkinter.TOP, fill = tkinter.X) # Channel-II-On/OFF FrameChannel2OnOff = tkinter.Frame(Mainwindow, height = 30, width = 30, background = "#002040") # background = #002040 is dark blue FrameChannel2OnOff.pack(side = tkinter.TOP, fill = tkinter.X) # Channel-II-Separate FrameChannel2Separate = tkinter.Frame(Mainwindow, height = 10, width = 30, background = "#002040") # background = #002040 is dark blue FrameChannel2Separate.pack(side = tkinter.TOP, fill = tkinter.X) # Channel-III FrameChannel3 = tkinter.Frame(Mainwindow, height = 30, width = 30, background = "#002040") # background = #002040 is dark blue FrameChannel3.pack(side = tkinter.TOP, fill = tkinter.X) # Channel-III-Current FrameChannel3Current = tkinter.Frame(Mainwindow, height = 30, width = 30, background = "#002040") # background = #002040 is dark blue FrameChannel3Current.pack(side = tkinter.TOP, fill = tkinter.X) # Channel-III-On/OFF FrameChannel3OnOff = tkinter.Frame(Mainwindow, height = 30, width = 30, background = "#002040") # background = #002040 is dark blue FrameChannel3OnOff.pack(side = tkinter.TOP, fill = tkinter.X) # Channel-III-Separate FrameChannel3Separate = tkinter.Frame(Mainwindow, height = 10, width = 30, background = "#002040") # background = #002040 is dark blue FrameChannel3Separate.pack(side = tkinter.TOP, fill = tkinter.X) # Channel-IV FrameChannel4 = tkinter.Frame(Mainwindow, height = 30, width = 30, background = "#002040") # background = #002040 is dark blue FrameChannel4.pack(side = tkinter.TOP, fill = tkinter.X) # Channel-IV-Current FrameChannel4Current = tkinter.Frame(Mainwindow, height = 30, width = 30, background = "#002040") # background = #002040 is dark blue FrameChannel4Current.pack(side = tkinter.TOP, fill = tkinter.X) # Channel-IV-On/OFF FrameChannel4OnOff = tkinter.Frame(Mainwindow, height = 30, width = 30, background = "#002040") # background = #002040 is dark blue FrameChannel4OnOff.pack(side = tkinter.TOP, fill = tkinter.X) #Subframe for Python Version SubframePythonVersion = tkinter.Frame(FrameHeader, height = 10, width=30, background = "#002040") SubframePythonVersion.pack(side = tkinter.LEFT, fill = tkinter.X) #Subframe for Type SubframeType = tkinter.Frame(FrameHeader, height = 10, width=30, background = "#002040") SubframeType.pack(side = tkinter.LEFT, fill = tkinter.X) #Subframe for Serial Number SubframeSerialNumber = tkinter.Frame(FrameHeader, height = 10, width=30, background = "#002040") SubframeSerialNumber.pack(side = tkinter.LEFT, fill = tkinter.X) #Subframe for Firmware SubframeFirmware = tkinter.Frame(FrameHeader, height = 10, width=30, background = "#002040") SubframeFirmware.pack(side = tkinter.LEFT, fill = tkinter.X) #Label for Python Version LabelForPythonVersion = tkinter.Label(SubframeType, width=30, text = LocalisationFile.stLabelForPythonVersion, background = "#002040",foreground = "#FFFF5F") LabelForPythonVersion.pack(side = tkinter.LEFT, fill = tkinter.X) #Label for Type LabelForType = tkinter.Label(SubframeType, width=30, text = LocalisationFile.stLabelForType, background = "#002040",foreground = "#FFFF5F") LabelForType.pack(side = tkinter.LEFT, fill = tkinter.X) #Label for SerialNumber LabelForSerialNumber = tkinter.Label(SubframeSerialNumber, width=30, text = LocalisationFile.stLabelForSerialNumber, background = "#002040",foreground = "#FFFF5F") LabelForSerialNumber.pack(side = tkinter.LEFT, fill = tkinter.X) #Label for Firmware LabelForFirmware = tkinter.Label(SubframeFirmware, width=30, text = LocalisationFile.stLabelForFirmware, background = "#002040",foreground = "#FFFF5F") LabelForFirmware.pack(side = tkinter.LEFT, fill = tkinter.X) # Button Choose Interface COM1 BuChooseCOM1 = tkinter.Button (FrameChooseInterface, text = "COM1" , background = "#304000", foreground = "#FFFF5F", command = SetToCOM1) # background "#304000" is drab green, foreground = "#FFFF5F" is yellow BuChooseCOM1.pack(side = tkinter.RIGHT) # Button Choose Interface COM2 BuChooseCOM2 = tkinter.Button (FrameChooseInterface, text = "COM2", background = "#304000", foreground = "#FFFF5F", command = SetToCOM2) # background "#304000" is drab green, foreground = "#FFFF5F" is yellow BuChooseCOM2.pack(side = tkinter.RIGHT) # Button Choose Interface COM3 BuChooseCOM3 = tkinter.Button (FrameChooseInterface, text = "COM3", background = "#304000", foreground = "#FFFF5F", command = SetToCOM3) # background "#304000" is drab green, foreground = "#FFFF5F" is yellow BuChooseCOM3.pack(side = tkinter.RIGHT) # Button Choose Interface COM4 BuChooseCOM4 = tkinter.Button (FrameChooseInterface, text = "COM4", background = "#304000", foreground = "#FFFF5F", command = SetToCOM4) # background "#304000" is drab green, foreground = "#FFFF5F" is yellow BuChooseCOM4.pack(side = tkinter.RIGHT) # Button Choose Interface COM5 BuChooseCOM5 = tkinter.Button (FrameChooseInterface, text = "COM5", background = "#304000", foreground = "#FFFF5F", command = SetToCOM5) # background "#304000" is drab green, foreground = "#FFFF5F" is yellow BuChooseCOM5.pack(side = tkinter.RIGHT) # Button Choose Interface COM6 BuChooseCOM6 = tkinter.Button (FrameChooseInterface, text = "COM6", background = "#304000", foreground = "#FFFF5F", command = SetToCOM6) # background "#304000" is drab green, foreground = "#FFFF5F" is yellow BuChooseCOM6.pack(side = tkinter.RIGHT) # Button Choose Interface COM7 BuChooseCOM7 = tkinter.Button (FrameChooseInterface, text = "COM7", background = "#304000", foreground = "#FFFF5F", command = SetToCOM7) # background "#304000" is drab green, foreground = "#FFFF5F" is yellow BuChooseCOM7.pack(side = tkinter.RIGHT) # Button Choose Interface COM8 BuChooseCOM8 = tkinter.Button (FrameChooseInterface, text = "COM8", background = "#304000", foreground = "#FFFF5F", command = SetToCOM8) # background "#304000" is drab green, foreground = "#FFFF5F" is yellow BuChooseCOM8.pack(side = tkinter.RIGHT) # Button Choose Interface ttyUSB0 BuChoosettyUSB0 = tkinter.Button (FrameChooseInterface, text = "ttyUSB0", background = "#304000", foreground = "#FFFF5F", command = SetTottyUSB0) # background "#304000" is drab green, foreground = "#FFFF5F" is yellow BuChoosettyUSB0.pack(side = tkinter.RIGHT) # Button Choose Interface ttyUSB1 BuChoosettyUSB1 = tkinter.Button (FrameChooseInterface, text = "ttyUSB1", background = "#304000", foreground = "#FFFF5F", command = SetTottyUSB1) # background "#304000" is drab green, foreground = "#FFFF5F" is yellow BuChoosettyUSB1.pack(side = tkinter.RIGHT) # Button Choose Interface ttyUSB2 BuChoosettyUSB2 = tkinter.Button (FrameChooseInterface, text = "ttyUSB2", background = "#304000", foreground = "#FFFF5F", command = SetTottyUSB2) # background "#304000" is drab green, foreground = "#FFFF5F" is yellow BuChoosettyUSB2.pack(side = tkinter.RIGHT) # Button Choose Interface ttyUSB3 BuChoosettyUSB3 = tkinter.Button (FrameChooseInterface, text = "ttyUSB3", background = "#304000", foreground = "#FFFF5F", command = SetTottyUSB3) # background "#304000" is drab green, foreground = "#FFFF5F" is yellow BuChoosettyUSB3.pack(side = tkinter.RIGHT) # Button End Programm BuEndProgram = tkinter.Button(FrameCommon, text = LocalisationFile.stBuEndProgram, background = "#304000", foreground = "#FFFF5F", command = EndProgram) # background "#304000" is drab green, foreground = "#FFFF5F" is yellow BuEndProgram.pack(side = tkinter.RIGHT) # Button Deutsch buttonDeutsch = tkinter.Button(FrameCommon, image = IconImageDeutsch, background = "#304000", foreground = "#FFFF5F", command = LocaGerman) buttonDeutsch.pack(side = tkinter.RIGHT) # Button British buttonBritish = tkinter.Button(FrameCommon, image = IconImageBritish, background = "#304000", foreground = "#FFFF5F", command = LocaBritish) buttonBritish.pack(side = tkinter.RIGHT) # Button AllChannelsOn BuAllChannelsON = tkinter.Button(FrameCommon, text = LocalisationFile.stBuAllChannelsON, background = "#408000", foreground = "#FFFF5F", command = SwitchAllChannelsON) # background "#408000" is green, foreground = "#FFFF5F" is yellow BuAllChannelsON.pack(side = tkinter.LEFT) # Button AllChannelsOFF BuAllChannelsOFF = tkinter.Button(FrameCommon, text = LocalisationFile.stBuAllChannelsOFF, background = "#408000", foreground = "#FFFF5F", command = SwitchAllChannelsOFF) # background "#408000" is green, foreground = "#FFFF5F" is yellow BuAllChannelsOFF.pack(side = tkinter.LEFT) # Button Colour BuColour = tkinter.Button(FrameCommon, text = "Colour", background = "#304000", foreground = "#FFFF5F", command = ChangeColour) # background "#304000" is drab green, foreground = "#FFFF5F" is yellow BuColour.pack(side = tkinter.LEFT) # Button Contrast BuContrast = tkinter.Button(FrameCommon, text = "Contrast", background = "#304000", foreground = "#FFFF5F", command = ChangeContrast) # background "#304000" is drab green, foreground = "#FFFF5F" is yellow BuContrast.pack(side = tkinter.LEFT) # Button Local BuLocal = tkinter.Button(FrameCommon, text = "Local", background = "#304000", foreground = "#FFFF5F", command = Local) # background "#304000" is drab green, foreground = "#FFFF5F" is yellow BuLocal.pack(side = tkinter.LEFT) # Button Remote BuRemote = tkinter.Button(FrameCommon, text = "Remote", background = "#304000", foreground = "#FFFF5F", command = Remote) # background "#304000" is drab green, foreground = "#FFFF5F" is yellow BuRemote.pack(side = tkinter.LEFT) # Button Refresh BuRefresh = tkinter.Button(FrameCommon, text = "Refresh", background = "#304000", foreground = "#FFFF5F", command = Refresh) # background "#304000" is drab green, foreground = "#FFFF5F" is yellow BuRefresh.pack(side = tkinter.LEFT) #Label for Channel1 LabelSetVoltage1 = tkinter.Label(FrameChannel1, width=23, text = LocalisationFile.stLabelSetVoltage1, background = "#002040",foreground = "#FFFF5F") LabelSetVoltage1.pack(side = tkinter.LEFT, fill = tkinter.X) #Button for copying SetVoltage1 to clipboard BuCopySetVoltage1ToClipb = tkinter.Button(FrameChannel1, text = LocalisationFile.stBuCopyToClipb, background = "#304000", foreground = "#FFFF5F", command = CopyVoltChanel1toClipb) BuCopySetVoltage1ToClipb.pack(side = tkinter.RIGHT) # Entry for Channel1 EntryChannel1 = tkinter.Entry(FrameChannel1, width=25, background = "#FFFF5F", foreground = "#000000", highlightcolor = "#00FF00", highlightthickness = 2) EntryChannel1.pack(side= tkinter.RIGHT) EntryChannel1.insert(25, Values.stSetVoltage1) EntryChannel1.bind("", ReturnSetVoltage1) #button for copying clipboard to Channel1 BuCopySetVoltage1FromClipb = tkinter.Button(FrameChannel1, text = LocalisationFile.stBuCopyFromClipb, background = "#304000", foreground = "#FFFF5F", command =InsertClipboardIntoSetVoltageChanel1) BuCopySetVoltage1FromClipb.pack(side = tkinter.RIGHT) #Label for CurrentChannel1 LabelSetCurrent1 = tkinter.Label(FrameChannel1Current, width=23, text = LocalisationFile.stLabelSetCurrent1, background = "#002040",foreground = "#FFFF5F") LabelSetCurrent1.pack(side = tkinter.LEFT, fill = tkinter.X) #Button for copying SetCurrent1 to clipboard BuCopySetCurrent1ToClipb = tkinter.Button(FrameChannel1Current, text = LocalisationFile.stBuCopyToClipb, background = "#408000", foreground = "#FFFF5F", command = CopyCurrentChanel1CurrentToClipb) BuCopySetCurrent1ToClipb.pack(side = tkinter.RIGHT) # Entry for CurrentChannel1 EntryChannel1Current = tkinter.Entry(FrameChannel1Current, width=25, background = "#FFFF5F", foreground = "#000000", highlightcolor = "#00FF00", highlightthickness = 2) EntryChannel1Current.pack(side= tkinter.RIGHT) EntryChannel1Current.insert(25, Values.stSetCurrent1) EntryChannel1Current.bind("", ReturnSetCurrent1) #button for copying clipboard to Channel1Current BuCopySetCurrent1FromClipb = tkinter.Button(FrameChannel1Current, text = LocalisationFile.stBuCopyFromClipb, background = "#304000", foreground = "#FFFF5F", command = InsertClipboardIntoSetCurrentChanel1) BuCopySetCurrent1FromClipb.pack(side = tkinter.RIGHT) # Button Channel-1-ON/OFF BuChannel1OnOff = tkinter.Button(FrameChannel1OnOff, text = LocalisationFile.stBuChannel1On, background = "#408000", foreground = "#FFFF5F", command = SwitchChannel1) BuChannel1OnOff.pack(side = tkinter.LEFT) # Button Channel-1-Ramp BuChannel1RampPower = tkinter.Button(FrameChannel1OnOff, text =LocalisationFile.stBuRampPower1, background ="#304000", foreground = "#FFFF5F", command = RampPowerChannel1) BuChannel1RampPower.pack(side = tkinter.LEFT) # Button Channel-1-PowerCycle BuChannel1autoPowerCycle = tkinter.Button(FrameChannel1OnOff, text =LocalisationFile.stBuAutoPowerCycleChannel1, background = "#304000", foreground = "#FFFF5F", command = AutoPowerCycleChannel1) BuChannel1autoPowerCycle.pack(side = tkinter.LEFT) # Button Channel-1-CoarseStepUp BuChannel1CoarseStepUp = tkinter.Button(FrameChannel1OnOff, text =LocalisationFile.stBuCoarseStepUpChannel1, background = "#304000", foreground = "#FFFF5F", command = Channel1StepUp) BuChannel1CoarseStepUp.pack(side = tkinter.LEFT) # Button Channel-1-CoarseStepDown BuChannel1CoarseStepDown = tkinter.Button(FrameChannel1OnOff, text =LocalisationFile.stBuCoarseStepDownChannel1, background = "#304000", foreground = "#FFFF5F", command = Channel1StepDown) BuChannel1CoarseStepDown.pack(side = tkinter.LEFT) # Button Channel-1-SetTo5V BuChannel1SetTo5V = tkinter.Button(FrameChannel1OnOff, text =LocalisationFile.stBuSetTo5VChannel1, background = "#304000", foreground = "#FFFF5F", command = SetTo5VChanel1) BuChannel1SetTo5V.pack(side = tkinter.LEFT) # Button Channel-1-SetTo12V BuChannel1SetTo12V = tkinter.Button(FrameChannel1OnOff, text =LocalisationFile.stBuSetTo12VChannel1, background = "#304000", foreground = "#FFFF5F", command = SetTo12VChanel1) BuChannel1SetTo12V.pack(side = tkinter.LEFT) # Button Channel-1-SetTo24V BuChannel1SetTo24V = tkinter.Button(FrameChannel1OnOff, text =LocalisationFile.stBuSetTo24VChannel1, background = "#304000", foreground = "#FFFF5F", command = SetTo24VChanel1) BuChannel1SetTo24V.pack(side = tkinter.LEFT) # Button Channel-1-SetTo30V BuChannel1SetTo30V = tkinter.Button(FrameChannel1OnOff, text =LocalisationFile.stBuSetTo30VChannel1, background = "#304000", foreground = "#FFFF5F", command = SetTo30VChanel1) BuChannel1SetTo30V.pack(side = tkinter.LEFT) #Label for Channel2 LabelSetVoltage2 = tkinter.Label(FrameChannel2, width=23, text = LocalisationFile.stLabelSetVoltage2, background = "#002040",foreground = "#FFFF5F") LabelSetVoltage2.pack(side = tkinter.LEFT, fill = tkinter.X) #Button for copying SetVoltage2 to clipboard BuCopySetVoltage2ToClipb = tkinter.Button(FrameChannel2, text = LocalisationFile.stBuCopyToClipb, background = "#304000", foreground = "#FFFF5F", command = CopyVoltChanel2toClipb) BuCopySetVoltage2ToClipb.pack(side = tkinter.RIGHT) # Entry for Channel2 EntryChannel2 = tkinter.Entry(FrameChannel2, width=25, background = "#FFFF5F", foreground = "#000000", highlightcolor = "#00FF00", highlightthickness = 2) EntryChannel2.pack(side= tkinter.RIGHT) EntryChannel2.insert(25, Values.stSetVoltage2) EntryChannel2.bind("", ReturnSetVoltage2) #button for copying clipboard to Channel2 BuCopySetVoltage2FromClipb = tkinter.Button(FrameChannel2, text = LocalisationFile.stBuCopyFromClipb, background = "#304000", foreground = "#FFFF5F", command = InsertClipboardIntoSetVoltageChanel2) BuCopySetVoltage2FromClipb.pack(side = tkinter.RIGHT) #Label for CurrentChannel2 LabelSetCurrent2 = tkinter.Label(FrameChannel2Current, width=23, text = LocalisationFile.stLabelSetCurrent2, background = "#002040",foreground = "#FFFF5F") LabelSetCurrent2.pack(side = tkinter.LEFT, fill = tkinter.X) #Button for copying SetCurrent2 to clipboard BuCopySetCurrent2ToClipb = tkinter.Button(FrameChannel2Current, text = LocalisationFile.stBuCopyToClipb, background = "#304000", foreground = "#FFFF5F", command = CopyCurrentChanel2CurrentToClipb) BuCopySetCurrent2ToClipb.pack(side = tkinter.RIGHT) # Entry for CurrentChannel2 EntryChannel2Current = tkinter.Entry(FrameChannel2Current, width=25, background = "#FFFF5F", foreground = "#000000", highlightcolor = "#00FF00", highlightthickness = 2) EntryChannel2Current.pack(side= tkinter.RIGHT) EntryChannel2Current.insert(25, Values.stSetCurrent2) EntryChannel2Current.bind("", ReturnSetCurrent2) #button for copying SetCurrent2 from Clipboard BuCopySetCurrent2FromClipb = tkinter.Button(FrameChannel2Current, text = LocalisationFile.stBuCopyFromClipb, background = "#304000", foreground = "#FFFF5F", command = InsertClipboardIntoSetCurrentChanel2) BuCopySetCurrent2FromClipb.pack(side = tkinter.RIGHT) # Button Channel-2-ON/OFF BuChannel2OnOff = tkinter.Button(FrameChannel2OnOff, text = LocalisationFile.stBuChannel2On, background = "#408000", foreground = "#FFFF5F", command = SwitchChannel2) BuChannel2OnOff.pack(side = tkinter.LEFT) #Label for Channel3 LabelSetVoltage3 = tkinter.Label(FrameChannel3, width=23, text = LocalisationFile.stLabelSetVoltage3, background = "#002040",foreground = "#FFFF5F") LabelSetVoltage3.pack(side = tkinter.LEFT, fill = tkinter.X) #Button for copying SetVoltage3 to clipboard BuCopySetVoltage3ToClipb = tkinter.Button(FrameChannel3, text = LocalisationFile.stBuCopyToClipb, background = "#304000", foreground = "#FFFF5F", command =CopyVoltChanel3toClipb) BuCopySetVoltage3ToClipb.pack(side = tkinter.RIGHT) # Entry for Channel3 EntryChannel3 = tkinter.Entry(FrameChannel3, width=25, background = "#FFFF5F", foreground = "#000000", highlightcolor = "#00FF00", highlightthickness = 2) EntryChannel3.pack(side= tkinter.RIGHT) EntryChannel3.insert(25, Values.stSetVoltage3) EntryChannel3.bind("", ReturnSetVoltage3) #button for copying clipboard to Channel3 BuCopySetVoltage3FromClipb = tkinter.Button(FrameChannel3, text = LocalisationFile.stBuCopyFromClipb, background = "#304000", foreground = "#FFFF5F", command = InsertClipboardIntoSetVoltageChanel3) BuCopySetVoltage3FromClipb.pack(side = tkinter.RIGHT) #Label for CurrentChannel3 LabelSetCurrent3 = tkinter.Label(FrameChannel3Current, width=23, text = LocalisationFile.stLabelSetCurrent3, background = "#002040",foreground = "#FFFF5F") LabelSetCurrent3.pack(side = tkinter.LEFT, fill = tkinter.X) #Button for copying SetCurrent3 to clipboard BuCopySetCurrent3ToClipb = tkinter.Button(FrameChannel3Current, text = LocalisationFile.stBuCopyToClipb, background = "#304000", foreground = "#FFFF5F", command = CopyCurrentChanel3CurrentToClipb) BuCopySetCurrent3ToClipb.pack(side = tkinter.RIGHT) # Entry for CurrentChannel3 EntryChannel3Current = tkinter.Entry(FrameChannel3Current, width=25, background = "#FFFF5F", foreground = "#000000", highlightcolor = "#00FF00", highlightthickness = 2) EntryChannel3Current.pack(side= tkinter.RIGHT) EntryChannel3Current.insert(25, Values.stSetCurrent3) EntryChannel3Current.bind("", ReturnSetCurrent3) #button for copying SetCurrent3 from Clipboard BuCopySetCurrent3FromClipb = tkinter.Button(FrameChannel3Current, text = LocalisationFile.stBuCopyFromClipb, background = "#304000", foreground = "#FFFF5F", command = InsertClipboardIntoSetCurrentChanel3) BuCopySetCurrent3FromClipb.pack(side = tkinter.RIGHT) # Button Channel-3-ON/OFF BuChannel3OnOff = tkinter.Button(FrameChannel3OnOff, text = LocalisationFile.stBuChannel3On, background = "#408000", foreground = "#FFFF5F", command = SwitchChannel3) # background "#408000" is green, foreground = "#FFFF5F" is yellow BuChannel3OnOff.pack(side = tkinter.LEFT) #Label for Channel4 LabelSetVoltage4 = tkinter.Label(FrameChannel4, width=23, text = LocalisationFile.stLabelSetVoltage3, background = "#002040",foreground = "#FFFF5F") LabelSetVoltage4.pack(side = tkinter.LEFT, fill = tkinter.X) #Button for copying SetVoltage4 to clipboard BuCopySetVoltage4ToClipb = tkinter.Button(FrameChannel4, text = LocalisationFile.stBuCopyToClipb, background = "#304000", foreground = "#FFFF5F", command =CopyVoltChanel4toClipb) BuCopySetVoltage4ToClipb.pack(side = tkinter.RIGHT) # Entry for Channel4 EntryChannel4 = tkinter.Entry(FrameChannel4, width=25, background = "#FFFF5F", foreground = "#000000", highlightcolor = "#00FF00", highlightthickness = 2) EntryChannel4.pack(side= tkinter.RIGHT) EntryChannel4.insert(25, Values.stSetVoltage4) EntryChannel4.bind("", ReturnSetVoltage4) #button for copying clipboard to Channel4 BuCopySetVoltage4FromClipb = tkinter.Button(FrameChannel4, text = LocalisationFile.stBuCopyFromClipb, background = "#304000", foreground = "#FFFF5F", command = InsertClipboardIntoSetVoltageChanel4) BuCopySetVoltage4FromClipb.pack(side = tkinter.RIGHT) #Label for CurrentChannel4 LabelSetCurrent4 = tkinter.Label(FrameChannel4Current, width=23, text = LocalisationFile.stLabelSetCurrent3, background = "#002040",foreground = "#FFFF5F") LabelSetCurrent4.pack(side = tkinter.LEFT, fill = tkinter.X) #Button for copying SetCurrent4 to clipboard BuCopySetCurrent4ToClipb = tkinter.Button(FrameChannel4Current, text = LocalisationFile.stBuCopyToClipb, background = "#304000", foreground = "#FFFF5F", command = CopyCurrentChanel4CurrentToClipb) BuCopySetCurrent4ToClipb.pack(side = tkinter.RIGHT) # Entry for CurrentChannel4 EntryChannel4Current = tkinter.Entry(FrameChannel4Current, width=25, background = "#FFFF5F", foreground = "#000000", highlightcolor = "#00FF00", highlightthickness = 2) EntryChannel4Current.pack(side= tkinter.RIGHT) EntryChannel4Current.insert(25, Values.stSetCurrent4) EntryChannel4Current.bind("", ReturnSetCurrent4) #button for copying SetCurrent4 from Clipboard BuCopySetCurrent4FromClipb = tkinter.Button(FrameChannel4Current, text = LocalisationFile.stBuCopyFromClipb, background = "#304000", foreground = "#FFFF5F", command = InsertClipboardIntoSetCurrentChanel4) BuCopySetCurrent4FromClipb.pack(side = tkinter.RIGHT) # Button Channel-4-ON/OFF BuChannel4OnOff = tkinter.Button(FrameChannel4OnOff, text = LocalisationFile.stBuChannel4On, background = "#408000", foreground = "#FFFF5F", command = SwitchChannel4) BuChannel4OnOff.pack(side = tkinter.LEFT) TypeSeriennummer() ActualChannelStatus() ActualSets() #update() # InfinityLoop Mainwindow.mainloop()