带滑块的 GRC QT GUI 范围显示错误
GRC QT GUI Range with slider presents error
使用 GNU Radio Companion 3.9.4.0.
我的应用程序有一个“QT GUI 范围”块。当 Widget 设置为“Counter + Slider”时,出现错误
TypeError: setRange(self, int, int): argument 2 has unexpected type 'float'
此条件的 Python 代码是,
self._rf_gain_win = RangeWidget(self._rf_gain_range, self.set_rf_gain, "RF Gain", "counter_slider", float, QtCore.Qt.Horizontal)
Widget 设置为“Counter”时没有错误。现在相同的 Python 行是,
self._rf_gain_win = RangeWidget(self._rf_gain_range, self.set_rf_gain, "RF Gain", "counter", float, QtCore.Qt.Horizontal)
如何使用所需的滑块?
= = =
完整的错误信息是:
File "C:\Users\User1\Documents\Records\Software Defined Radio - SDR\GNU Radio\Flowgraphs\HackADay Tutorials\Video 02\Simple_AM_Rx_01_temp.py", line 100, in __init__
self._rf_gain_win = RangeWidget(self._rf_gain_range, self.set_rf_gain, "RF Gain", "counter_slider", float, QtCore.Qt.Horizontal)
File "C:\Users\User1\miniforge3\envs\gnuradio\lib\site-packages\gnuradio\qtgui\range.py", line 121, in __init__
self.d_widget = self.CounterSlider(self, self.range, self.notifyChanged, rangeType, orientation)
File "C:\Users\User1\miniforge3\envs\gnuradio\lib\site-packages\gnuradio\qtgui\range.py", line 262, in __init__
self.slider = RangeWidget.Slider(parent, ranges, self.sliderChanged, rangeType, orientation)
File "C:\Users\User1\miniforge3\envs\gnuradio\lib\site-packages\gnuradio\qtgui\range.py", line 161, in __init__
self.setRange(0, ranges.nsteps - 1)
TypeError: setRange(self, int, int): argument 2 has unexpected type 'float'
您的回溯表明文件 C:\Users\User1\miniforge3\envs\gnuradio\lib\site-packages\gnuradio\qtgui\range.py
有这一行:
self.setRange(0, ranges.nsteps - 1)
但是当我检查这个项目的存储库时here 我看到了
self.setRange(0, int(ranges.nsteps - 1))
他们纠正了一个错误。您正在使用该项目的过时版本。
使用 GNU Radio Companion 3.9.4.0.
我的应用程序有一个“QT GUI 范围”块。当 Widget 设置为“Counter + Slider”时,出现错误
TypeError: setRange(self, int, int): argument 2 has unexpected type 'float'
此条件的 Python 代码是,
self._rf_gain_win = RangeWidget(self._rf_gain_range, self.set_rf_gain, "RF Gain", "counter_slider", float, QtCore.Qt.Horizontal)
Widget 设置为“Counter”时没有错误。现在相同的 Python 行是,
self._rf_gain_win = RangeWidget(self._rf_gain_range, self.set_rf_gain, "RF Gain", "counter", float, QtCore.Qt.Horizontal)
如何使用所需的滑块?
= = =
完整的错误信息是:
File "C:\Users\User1\Documents\Records\Software Defined Radio - SDR\GNU Radio\Flowgraphs\HackADay Tutorials\Video 02\Simple_AM_Rx_01_temp.py", line 100, in __init__
self._rf_gain_win = RangeWidget(self._rf_gain_range, self.set_rf_gain, "RF Gain", "counter_slider", float, QtCore.Qt.Horizontal)
File "C:\Users\User1\miniforge3\envs\gnuradio\lib\site-packages\gnuradio\qtgui\range.py", line 121, in __init__
self.d_widget = self.CounterSlider(self, self.range, self.notifyChanged, rangeType, orientation)
File "C:\Users\User1\miniforge3\envs\gnuradio\lib\site-packages\gnuradio\qtgui\range.py", line 262, in __init__
self.slider = RangeWidget.Slider(parent, ranges, self.sliderChanged, rangeType, orientation)
File "C:\Users\User1\miniforge3\envs\gnuradio\lib\site-packages\gnuradio\qtgui\range.py", line 161, in __init__
self.setRange(0, ranges.nsteps - 1)
TypeError: setRange(self, int, int): argument 2 has unexpected type 'float'
您的回溯表明文件 C:\Users\User1\miniforge3\envs\gnuradio\lib\site-packages\gnuradio\qtgui\range.py
有这一行:
self.setRange(0, ranges.nsteps - 1)
但是当我检查这个项目的存储库时here 我看到了
self.setRange(0, int(ranges.nsteps - 1))
他们纠正了一个错误。您正在使用该项目的过时版本。