python编程控制示波器设备_基于Python的示波器的截屏GUI界面[通俗易懂]

python编程控制示波器设备_基于Python的示波器的截屏GUI界面[通俗易懂]importtimeimporttkinterastkfromtkinterimport*fromtkinterimportttkclassScreenCapture(object):def__init__(self):self.idn=self.__class__.__name__#InstrumentInitialisation#self.instr=MyIn…

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全系列IDE稳定放心使用

importtime

importtkinter astk

fromtkinter import*

fromtkinter importttk

classScreenCapture(object):

def__init__(self):

self.idn = self.__class__.__name__

# Instrument Initialisation

# self.instr = MyInstruments()

self.timestamp = time.strftime(‘%d-%b-%Y_%I.%M.%S_%p’)

self.results_folder = ‘%s%s%s’% (‘./EvalData/’, self.timestamp, ‘/’)

defgui_setup(self):

# Title and window size

win = tk.Tk()

win.title(“Screen Capture GUI”)

win.geometry(‘550×400’)

# CH Name Setting

label1 = ttk.Label(win, text=’CH1:LABEL:NAME’).grid(column=0, row=0)

text1 = tk.Text(width = 10, height = 1)

text1.grid(column=1, row=0)

text1.insert(INSERT,’LX1′)

label2 = ttk.Label(win, text=’CH2:LABEL:NAME’).grid(column=0, row=1)

text2 = tk.Text(width = 10, height = 1)

text2.grid(column=1, row=1)

text2.insert(INSERT,’VOUT’)

label3 = ttk.Label(win, text=’CH3:LABEL:NAME’).grid(column=0, row=2)

text3 = tk.Text(width = 10, height = 1)

text3.grid(column=1, row=2)

text3.insert(INSERT,’LX2′)

label4 = ttk.Label(win, text=’CH4:LABEL:NAME’).grid(column=0, row=3)

text4 = tk.Text(width = 10, height = 1)

text4.grid(column=1, row=3)

text4.insert(INSERT, ‘IOUT’)

# CH Offset Setting

ttk.Label(win, text=”CH1 Offset”).grid(column=2, row=0)

ch1offset = StringVar()

ch1offset_set = Scale(win, from_=0, to=2, orient=HORIZONTAL, resolution=0.01, tickinterval=100, length=100, variable=ch1offset)

ch1offset_set.grid(column=3, row=0)

ttk.Label(win, text=”CH2 Offset”).grid(column=2, row=1)

ch2offset = StringVar()

ch2offset_set = Scale(win, from_=0, to=2, orient=HORIZONTAL, resolution=0.01, tickinterval=10, length=100, variable=ch2offset)

ch2offset_set.grid(column=3, row=1)

ttk.Label(win, text=”CH3 Offset”).grid(column=2, row=2)

ch3offset = StringVar()

ch3offset_set = Scale(win, from_=0, to=2, orient=HORIZONTAL, resolution=0.01, tickinterval=10, length=100, variable=ch2offset)

ch3offset_set.grid(column=3, row=2)

ttk.Label(win, text=”CH4 Offset”).grid(column=2, row=3)

ch4offset = StringVar()

ch4offset_set = Scale(win, from_=0, to=2, orient=HORIZONTAL, resolution=0.01, tickinterval=10, length=100, variable=ch4offset)

ch4offset_set.grid(column=3, row=3)

# Input Voltage setting

ttk.Label(win, text=”INPUT VOLTAGE[V]”).grid(column=0, row=4)

vin = tk.StringVar()

vin_set = ttk.Combobox(win, width=10, textvariable=vin)

vin_set[‘values’] = (2.5, 3.0, 3.5, 3.7, 4.0, 4.5, 5.0, 5.5)

vin_set.grid(column=1, row=4)

vin_set.current(3)

# Output Current Setting

ttk.Label(win, text=”LOAD CURRENT[A]”).grid(column=0, row=5)

iout = tk.StringVar()

iout_set = ttk.Combobox(win, width=10, textvariable=iout)

iout_set[‘values’] = (0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0)

iout_set.grid(column=1, row=5)

iout_set.current(0)

# Trigger choose and type setting

ttk.Label(win, text=”CH Num of Trigger”).grid(column=0, row=6)

number = tk.StringVar()

numberChosen = ttk.Combobox(win, width=10, textvariable=number)

numberChosen[‘values’] = (‘CH1′,’CH2’, ‘CH3’, ‘CH4’)

numberChosen.grid(column=1, row=6)

numberChosen.current(3)

riseorfall = tk.StringVar()

riseorfallChosen = ttk.Combobox(win, width=10, textvariable=riseorfall)

riseorfallChosen[‘values’] = (‘Rise’,’Fall’)

riseorfallChosen.grid(column=2, row=6)

riseorfallChosen.current(1)

# Screen Capture button

action = ttk.Button(win, text=”Screen Capture”)

action.grid(column=1, row=10)

tk.mainloop()

if__name__ == ‘__main__’:

meas = ScreenCapture()

try:

meas.gui_setup()

finally:

pass

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/182883.html原文链接:https://javaforall.net

(0)
上一篇 2022年10月12日 上午10:00
下一篇 2022年10月12日 上午10:16


相关推荐

  • php中require、require_once、include、include_once类库重复引入效率问题详解

    php中require、require_once、include、include_once类库重复引入效率问题详解转载自黄寿松的博客 php 中 require require once include include once 类库重复引入效率问题详解 include 与 require 的功能相同唯一不同 require 不管是否被执行 只要存在 php 在执行前都会预引入 include 则是执行到该语句时才进行引入 include once 与 require once 都是检测文件是否被引入 被引入则不会引入唯一不同 require once 为无条件包含 顾名思义也就是引入后如遇到错误则

    2026年3月19日
    2
  • redis:Could not connect to Redis at 127.0.0.1:6379: Connection refused错误解析「建议收藏」

    redis:Could not connect to Redis at 127.0.0.1:6379: Connection refused错误解析「建议收藏」1.错误信息思考:根据错误信息的字面意思,可以知道,redis-cli客户端程序,通过ip127.0.0.1,端口6379与redis服务器建立连接失败。说明当我们调用redis-cli时,默认是用本地回环地址去与服务器端建立连接。2.解决问题思路:服务器程序会在监听一个套接字(IP+端口号),等待客户端的连接。一般运行服务器程序的时候,都会加载一个配置文件。redis服务器也会读取一个配置文件。如果不知道配置文件在哪里,可以使用:whichredis.conf#或者whe

    2022年5月2日
    119
  • 《数据结构导论自考知识点(自己总结)》「建议收藏」

    《数据结构导论自考知识点(自己总结)》「建议收藏」《数据结构导论自考知识点》一、线性表:1、插入:从后往前挪,删除:从前往后挪2、顺序存储(方式:for循环)3、链式存储:{单链表的一个结点由两部分组成,数据元素和指针。datanext^^数据指针}二、栈、队列:4、栈:top++入栈,top–出栈5、队列:顺序队列,出队操作队首,指针后移一位,front=(front+1)%习题:一个二维数组,…

    2022年8月18日
    5
  • AsyncTask原理

    AsyncTask原理为什么要用 AsyncTask 我们知道 Android 应用的主线程 UI 线程 是线程不安全的 负责前台用户界面的绘制以及响应用户的操作 肩负着绘制用户界面和及时响应用户操作的重任 为了避免 用户点击按钮后没反应 这样的糟糕用户体验 我们就要确保主线程时刻保持着较高的响应性 主线程不能够运行需要占用大量 CPU 时间片的任务 如大量复杂的浮点运算 较大的磁盘 IO 操作 网络 socket 等 为了做到这一点

    2026年3月18日
    2
  • ubuntu下安装RabbitVCS

    ubuntu下安装RabbitVCS习惯了在windows下的Tortoisesvn,所以转到ubuntu下面很不习惯命令行的svn。而且,个人感觉如果需要showlog和diff的话都很不爽。今天和一个朋友聊天,他推荐我使用RabbitVCS。类似与Tortoisesvn。安装RabbitVCS的方法步骤如下:1、sudoadd-apt-repositoryppa:rabbitvcs/ppa     #

    2022年7月18日
    32
  • 文心一言优缺点分析及百度搜索引擎算法影响

    文心一言优缺点分析及百度搜索引擎算法影响

    2026年3月12日
    3

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号