Hello house,
I kindly need a solution to this: http://stackoverflow.com/questions/42316495/wxpython-display-text-from-two-dialogs-printed-on-a-third-dialog
Basic calculations are carried out on the Box1 and Box2, how do I display the sum of the calculation the third dialog, that is on Box3?
How do I get to display a text result from Box1 and Box2 on Box3?
I have also attached the code here.
Thanks in advance for your time.
three_dialogs.py (7.88 KB)
Hi,
probably the most straightforward way to make you code work somehow
could adding a global - toplevel list,
e.g. just below "import wx"
price_items_lst =
than you can use
price_items_lst.append(price)
or
price_items_lst.append(add_price)
instead of your current print statements,
and finaly use
self.totalText1.SetLabel(str(sum(price_items_lst)))
I recognise, that this is somawhat hackish solution, at least it
doesn't follow the encapsulation, you are probably attempting by using
the different dialog classes. etc.
I'd probably prefer another form of the GUI (e.g. one frame/panel with
all the needed widgets at once - instead of isolated dialogs). In any
case you need some methods for passing the values for your input (and
output) data. - You can use a global variable/container like in this
trivial case, another possibility are class/instance attributes,
function calls with parameters or specialised mechanisms like pubsub.
(cf. wxPython and PubSub: A Simple Tutorial - Mouse Vs Python
)
In any case, I believe, you will get more competent suggestions on this list.
hth,
vbr
ยทยทยท
2017-02-18 15:41 GMT+01:00 Umar Yusuf <bintacomputers@gmail.com>:
Hello house,
I kindly need a solution to this:
python 2.7 - wxPython - Display text from two dialogs printed on a third dialog - Stack Overflow
Basic calculations are carried out on the Box1 and Box2, how do I display
the sum of the calculation the third dialog, that is on Box3?
How do I get to display a text result from Box1 and Box2 on Box3?
I have also attached the code here.
Thanks in advance for your time.
--
You received this message because you are subscribed to the Google Groups
"wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to wxpython-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.