Skip to content

Commit e4a9179

Browse files
author
Dilmi Wickramanayake
committed
disable run button
1 parent 9105a3a commit e4a9179

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

examples/nidaqmx/nidaqmx_analog_input_filtering/nidaqmx_analog_input_filtering.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
available_trigger_sources.append(term)
4040
panel.set_value("available_trigger_sources", available_trigger_sources)
4141
try:
42+
panel.set_value("daq_error", "")
4243
print(f"Panel URL: {panel.panel_url}")
4344
print(f"Waiting for the 'Run' button to be pressed...")
4445
print(f"(Press Ctrl + C to quit)")
@@ -129,7 +130,6 @@
129130
)
130131

131132
try:
132-
panel.set_value("daq_error", "")
133133
task.start()
134134
panel.set_value("is_running", True)
135135

examples/nidaqmx/nidaqmx_analog_input_filtering/nidaqmx_analog_input_filtering_panel.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
CurrentUnits,
88
Edge,
99
FilterResponse,
10-
LoggingMode,
1110
Slope,
1211
StrainGageBridgeType,
1312
TerminalConfiguration,
@@ -46,17 +45,31 @@
4645
)
4746

4847

48+
def hide_buttons():
49+
st.markdown(
50+
"""
51+
<style>
52+
button[data-testid="stBaseButton-secondary"] {
53+
display: none;
54+
}
55+
</style>
56+
""",
57+
unsafe_allow_html=True,
58+
)
59+
60+
4961
with left_col:
5062
with st.container(border=True):
5163
is_running = panel.get_value("is_running", True)
5264
if is_running:
5365
st.button("Stop", key="stop_button")
5466
else:
55-
st.button("Run", key="run_button")
67+
run_button = st.button("Run", key="run_button")
5668
if panel.get_value("daq_error", "") == "":
5769
pass
5870
else:
59-
st.error(panel.get_value("daq_error", ""))
71+
hide_buttons()
72+
st.error(panel.get_value("daq_error", "") + " Please re-run script")
6073

6174
st.title("Channel Settings")
6275
physical_channel = st.selectbox(

0 commit comments

Comments
 (0)