Hi, rx seems very cool, but my studio is heavily built up using Qt through PySide, and there’s no appetite to migrate to another framework (like Panel) or split support.
As far as I can tell, I’m recreating the pandas dataframe example from the rx docs here Reactive Functions and Expressions — param v2.1.1 ,
only using a QLineEdit widget instance Synopsis - Qt for Python
instead of a pandas frame. If I try to bind the rx setText
with an rx-wrapped string, or even a normal string, nothing happens.
I’ve tried introspecting the rx stuff as it executes to see what the issue is, but the accessor system’s interaction with getattribute is a bit beyond me.
I wondered if this is a known issue, or you have any advice. Thanks.
from param.reactive import rx
from PySide2 import QtWidgets # or PySide6, I get the same result
text = "initial_value" # raw str text value
rxtext = rx(text)
# create the Qt application, required to start building widgets
# event loop doesn't run yet
app = QtWidgets.QApplication()
line = QtWidgets.QLineEdit() # create a QLineEdit widget instance
rxline = rx(line) # wrap widget instance in rx - which should also wrap all its methods
# by default QLineEdit has no displayed text
rxline.setText(rxtext) # link rx wrappers together
# see that the widget still has no text ._.
rxtext.rx.value = "second_value"
# still nothing ._.
# if we just call the normal method on the normal instance, obviously it works
# uncomment the line below to see desired result
# line.setText(text)
# display the widget
line.show()
# run the Qt application
app.exec_()
Thanks for your help