Håvard Vegge <hava...@stud.ntnu.no> writes:

Hi Håvard

> I'm developing a small application that will use VIFF. Instead of
> inputting values through the command line I would like to create a
> simple graphical interface.

That is an excellent idea!

> Have anyone experience with such GUI toolkits? Any recommendations?
>
> - I've barely tested PyQt, but it has some dual commercial/GPL
> license that I probably want to avoid.
> - Tkinter is the "standard" GUI toolkit for Python, but is reported
> to have a non-native look and feel.
> - wxPython is maybe the most popular GUI toolkit for Python, so
> perhaps I give it a try.

I would go for PyGTK, which has a Twisted integration available:

  
http://twistedmatrix.com/projects/core/documentation/howto/choosing-reactor.html#auto11

This is important in order to be able to run both the network and
graphical event loops.

I once played with it, please see

  viff/apps/double-auction/client.py

for a simple program that uses PyGTK with Twisted. It doesn't do
anything VIFF related, though.

In order to actually do something VIFFy with it, I imagine you would
have a button with a callback like this:

  def start_clicked():
    r = create_runtime(...)
    r.addCallback(go)

The go function could then let one of the players input a number:

  def go(runtime):
    if runtime.id == 1:
      x = int(some_input_field.text)
    else:
      x = None
    x = runtime.shamir_share([1], Zp, x)
    y = x * x
    z = runtime.open(y)
    z.addCallback(update_output)

Here I guess a text input field in GTK has a text attribute...
Finally, update_output would do:

  def update_output(output):
    some_label.text = "Shared number: %d" % output.value

I talked about this with Tomas Toft just the other day, so maybe he
can contribute more to the pseudo-code :-)

There were a slightly tricky issue with the synchronization of program
counters that we had to think about, but now I don't remember the
details. But I know that Tomas has a photo of our blackboard... :-)

-- 
Martin Geisler

VIFF (Virtual Ideal Functionality Framework) brings easy and efficient
SMPC (Secure Multiparty Computation) to Python. See: http://viff.dk/.
_______________________________________________
viff-devel mailing list (http://viff.dk/)
viff-devel@viff.dk
http://lists.viff.dk/listinfo.cgi/viff-devel-viff.dk

Reply via email to