RE: visual gui ides for python/jythpn
Luis M. Gonzalez wrote: > PythonCard is an extremely easy to use alternative. > It's like a simplified Visual Basic or Delphi IDE. > Check IT out: www.pythoncard.org I second that! PythonCard is a rapid way to prototype an ugly Windows GUI. (It's not PythonCard's fault that Windows are ugly. ;) ) I use it for prototyping. But ONLY for prototyping. At least with my version in Windows, it's got bugs in the resource editor. For example, Korean characters in Korean fonts are rotated sideways. And the color of a font can't be changed; only the foreground color can, which corrupts button display. The send to back/front options don't seem to work. Transparent images (like PNG) don't seem to work ... for me, anway. Yet, still, when I'm rapidly developing the mechanics of a game and need a GUI front-end, PythonCard was a quick solution. It brilliantly stores the GUI as a recursive dictionary, which is like XML, only easy for a human to read. The widgets require very little of your coding. It's got a lot of samples, which makes some of its peculiar conventions easy to apply. And any Python app made with the PythonCard framework has a namespace viewer, shell, and GUI message integrated into the application. Flash and Python: The ultimate GUI prototyping combo? In my dreams, I would use Flash for the GUI portion of a Python app. Flash is by far my favorite environment for rapidly designing interfaces. It is an (almost) object-oriented drawing environment that can quickly produce good visual design. Because the elements are instances of prototypes (Flash calls them symbols), they can be easily replaced and updated at any time. The timeline, animation, color, layer, and drawing tools are wonderful. You can quickly make traditional or experimental interfaces. The only thing that sucked (for me), was ActionScript. It's not bad. It's quite good for interface scripting. But for back-end procedures it is prison compared to Python. Does anyone successfully use a Flash front-end and Python back-end in real-time? I've tried an example of XMLRPC servers where a Flash app (SWF) communicates with Python (http://www.cs.unc.edu/~parente/tech/tr01.shtml), but that has a round-trip time that is too slow for something like a videogame (updates at 30 frames per second). Some of the projects at OS flash look promising (http://osflash.org/ext_howto), but I haven't found the part that says that my interface made in Macromedia Flash (which is a fantastic design environment) can be used with my code in Python with a real-time frame rate. -- Ethan -- http://mail.python.org/mailman/listinfo/python-list
RE: Does altering a private member decouple the property's value?
Thanks for the help! Using the "class name (object)" syntax fixed my problem. Usually, I don't need properties, but in the case of a dependent attribute, I used a set method of a property to update that dependent attribute. I have a stopwatch class with a time limit property. When the time limit is changed, the dependent attribute, remaining time, should also change. I am having to unteach myself some of the defensive programming techniques in C++, such as using name mangling to ensure privacy, when privacy is not the most important criterion. For prototyping, starting public and going "private" later is more efficient when refactoring. And since properties have the same access signature as a public member, it can be done without changes to the client. -- Ethan -- http://mail.python.org/mailman/listinfo/python-list
RE: Python IDE
xhm wrote: > PyScripter http://mmm-experts.com/Downloads.aspx?ProductId=4 If PyScripter is your style, Stani's Python Editor also is feature-rich and GUIy. Stani's Python Editor http://pythonide.blogspot.com/ It's got winpdb and a shell integrated. Although, from reading this thread, I've gone back to gVim, after years of absence. Since I already had to memorize the keyboard mapping for older projects, and I prefer unix-style regular expressions, gVim is awesome. But if you don't want to memorize keyboard commands, vim is not for you. I like unit testing by running the unit test and appending the output to my development journal (With the "r !python" syntax). That way I have an ongoing record of problems and progress. I also agree with the philosophy that Ben echoed: Ben wrote: > GNU screen, Emacs or Vim, and Bash. The right tool for each job, and tools > that work well together, rather than a single tool trying to do everything > in its own isolated world. What I'm finding difficult, though, as some people brought up, is integrating gVim with an interactive shell or debugger. Currently I save to the script file and debug it in an interpreter. But I want to get at the results of the debugging to modify the script. And sometimes I want to take snippets from the script under construction, change them, and retest them in an interactive shell. I like what Roland devised: > With a python-enabled VIM it's possible to execute and thus test the > python code. I have the following lines in my vimrc. > F2 prints the result of a line evaluation on the bottom or in a window > named pyout if there. I open pyout with ":vert rightb new pyout" mapped to > F1. But for my trial-and-error style of exploring both Python and the algorithm under construction, I would rather run a dedicated shell or debugger outside of vim and send its output to vim. Would it be relatively easy to fork the debugger/shell input/output to a file which of course vim could access? Because IPython (http://ipython.scipy.org/) saves session input, has many conveniences, and _feels_ like vim, I wanted to use IPython for this purpose. But I've been stumped because I use doctest on Windows and I don't know how to make IPython use the doctest. Even after I tried the workaround provided in the IPython FAQ (http://ipython.scipy.org/moin/FAQ) the doctest was corrupted in IPython. -- Ethan -- http://mail.python.org/mailman/listinfo/python-list
Does altering a private member decouple the property's value?
Hello, There are a lot of Python mailing lists. I hope this is an appropriate one for a question on properties. I am relatively inexperienced user of Python. I came to it to prototype concepts for videogames. Having programmed in C, scripted in Unix shells, and scripted in a number of proprietary game scripting languages, I'm impressed at how well Python meets my needs. In almost all respects, it does what I've been wishing a language would do. One example is properties. I really like properties for readonly attributes, and their ability to make the interface more elegant, by hiding uninteresting methods (like dumb get/set accessors). As a user interface designer, I respect how this may prevent the programmer's deluge of unimportant information. I also value the ease of refactoring, which is a frequent task in my prototypes. But a gotcha bit me in the behavior of properties that I didn't expect. If another function accesses an underlying data member of a property, then the data member returned by the property is no longer valid. Here is a session example. PythonWin 2.4.3 - Enthought Edition 1.0.0 (#69, Aug 2 2006, 12:09:59) [MSC v.1310 32 bit (Intel)] on win32. Portions Copyright 1994-2004 Mark Hammond ([EMAIL PROTECTED]) - see 'Help/About PythonWin' for further copyright information. >>> class a_class: ... def __init__( self ): self.__p = None ... def __set_p( self, new_p ): self.__p = new_p ... def reset( self ): self.__p = None ... p = property( lambda self: self.__p, __set_p ) ... >>> a = a_class() >>> a.p >>> a.p = 1 >>> a.p 1 >>> a.reset() >>> a.p 1 Although the underlying value was reset, the property was not reset! Instead, if the property is edited, then all is fine. >>> class a_class: ... def __init__( self ): self.__p = None ... def __set_p( self, new_p ): self.__p = new_p ... def reset( self ): self.p = None # Property, not the private member ... p = property( lambda self: self.__p, __set_p ) ... >>> a = a_class() >>> a.p >>> a.p = 1 >>> a.reset() >>> a.p I had wanted to access the private data member in the class to avoid side-effects of the set method. Can someone show me how to reference the data member underlying a property and update the property without calling the property set method? By the way, I thought maybe that a variable outside of an __init__ method would be static, but as far as I can tell, it is dynamic. For example, the following class appeared equivalent to the above for tests. >>> class a_class: ... __p = None # No __init__ ... def __set_p( self, new_p ): self.__p = new_p ... def reset( self ): self.p = None ... p = property( lambda self: self.__p, __set_p ) ... >>> a = a_class() >>> a.p >>> a.p = 1 >>> a.reset() >>> a.p >>> I preferred not having the __init__ for this example and my prototype, because I wasn't doing anything fancy, and it meant one less method that the programmer needed to see. Again, the interface is cleaner. But does this cause an error for derived classes that would use the private data member? Without the __init__ method, is the derived class' __p equal to the base class' __p? I thought maybe the class was being referenced instead of the instance, but a second object had a different value. >>> b = a_class() >>> b.p >>> b.p = 2 >>> b.p 2 >>> b.reset() >>> a.p >>> a.p = 1 >>> a.p 1 >>> b.p >>> b.p = 2 >>> b.reset() >>> a.p 1 >>> b.p >>> Also properties don't show up in the dictionary if no assignment has been made, but once a property's assignment has been called, the property appears. An example follows: >>> import pprint >>> pprint.pprint( a.__dict__ ) {'p': 1} >>> pprint.pprint( b.__dict__ ) {'p': None} >>> c = a_class() >>> pprint.pprint( c.__dict__ ) {} >>> c.p >>> pprint.pprint( c.__dict__ ) {} Is that dictionary population behavior for detecting an uninitialized property? Thanks for your help. When my feet are properly wet, I look forward to contributing to the community. -- Ethan Kennerly -- http://mail.python.org/mailman/listinfo/python-list