For a computer architecture assignment, I am trying to replace a C++ library called "Sim" with something in Python.
I am already using MyHDL for the simulator, but the C++ program has a nice interactive feature that lets students see the compon开发者_运维技巧ents connected together (gates, inputs, outputs, flip flops, etc.) and toggle any signal.
I am attempting to create that interactive aspect and I just need to pick the library to use. I was wondering if wxPython would be a good choice in this case. The GUI mainly needs to draw gates or devices like flip flops and counters, use lines to connect them, and have some representation of signals (0 and 1 for instance or black and white).
Is wxPython a good idea, or are there better libraries for this application?
It sounds like you're simulating logic circuits? Depending on the kind of UI you are looking for, I'd say that wxPython could definitely do the job. You may not even need that, however.
Most python distributions include Tkinter, a fairly simple GUI library. There is an example here of an existing (albeit fairly old) Digital Circuit Simulator written in python using Tkinter and PMW:
http://cvs.savannah.gnu.org/viewvc/pydcs/?root=pydcs
I would also suggest taking a look at PyGame. Although it's billed as a game development library, it's actually quite fantastic for creating simulations of all kinds.
wxPython or pyside (Qt python bindings) are both ideal for this.
wx is a little better if you have any MFC experience, Qt is perhaps a more modern design.
wxPython and PyQt both are good option. I find Qt easy as compare to wxPython.
精彩评论