Re: Emacs vs. Eclipse vs. Vim
On Sat, 2008-11-29 at 12:44 -0800, Josh wrote: > If you were a beginning programmer and willing to make an investment in > steep learning curve for best returns down the road, which would you pick? > > I know this topic has been smashed around a bit already, but 'learning > curve' always seems to be an arguement. If you feel that one is easier > or harder than the others to learn feel free to tell, but let's not make > that the deciding factor. Which one will be most empowering down the > road as a development tool? > > Thanks in advance, > > JR > The first real text editor I used was Vim, which I actually started using about a year ago. I've looked at Emacs and it just looks confusing. It has key commands with key modifiers to do simple tasks (such as moving the cursor to the left). I used Eclipse for a while, but for programming in Python it really has no advantage over Vim, so back I went. Vim doesn't really have a steep learning curve, of course I used vimtutor to help me learn it. Anyway, play around with all three, and see which you like best. --Ratfink -- http://mail.python.org/mailman/listinfo/python-list
Re: PyOpenGL double-buffered hardware surface
On Sun, 2008-10-05 at 14:16 -0400, Mike C. Fletcher wrote: > Clay Hobbs wrote: > > How do I create a double-buffered hardware surface with PyOpenGL? I > > knew how to once, but forgot. > > > > > Depends on your GUI library, most of them have a flag-set that you pass > to the initializer of the OpenGL-holding widget. If you're using > Pygame, see Pygame's display module. If wxPython, see their GLcanvas > object. If GLUT, see glutInitDisplayMode, etceteras. > > Good luck, > Mike > I'm using wxPython. My real problem is that everything flashes when it moves. I thought the way to fix this was to make a double-buffered hardware surface, but I may be wrong. Thank you for the help so far, --Ratfink -- http://mail.python.org/mailman/listinfo/python-list
PyOpenGL + wxPython developer needed
I am working on a map editor for BZFlag (http://www.bzflag.org/), and I need help. Mostly, all I need help on is 3D rendering. I know nothing about OpenGL, so if you do, your help would be appreciated. The program I am making is called RatBZEdit (http://ratbzedit.sourceforge.net/). If you are interested, please contact me and I will probably add you to the project. --Ratfink -- http://mail.python.org/mailman/listinfo/python-list
How do I create user-defined warnings?
I already know how to make user-defined exceptions, like this one: class MyException(Exception): pass But for a module I'm making, I would like to make a warning (so it just prints the warning to stderr and doesn't crash the program). I have tried this: class MyWarning(Warning): pass And it behaves like a normal error. Please help me, I can't figure out what I'm doing wrong. -- Ratfink -- http://mail.python.org/mailman/listinfo/python-list
Problems with curses
I am making a text-based game similar to Zork with Python. I have decided to use the curses module, and have run into a problem. I want to scroll the commands and output up after a command is run instead of clearing the screen. But when I use std.scroll(), an exception is raised. Here is the program: #!/usr/bin/env python # text_adventure.py import curses import curses.wrapper def main(stdscr): curses.echo() stdscr.setscrreg(1, 24) score = 0 moves = 0 statusbar = stdscr.subwin(2, 80, 0, 0) statusbar.addstr(0, 0, 'Dingo'+' '*(58-len('Dingo'))+'Score: %03d Moves: %03d'%(score, moves), curses.A_REVERSE) stdscr.addstr(24, 0, '> ') x = stdscr.getstr(24, 2) x = str(x) stdscr.refresh() #stdscr.erase() stdscr.scroll(3) statusbar.erase() statusbar.addstr(0, 0, x+' '*(58-len(x))+'Score: %03d Moves: % 03d'%(score, moves), curses.A_REVERSE) stdscr.addstr(24, 0, '> ') stdscr.getstr(24, 2) curses.wrapper(main) Unfortunately, the error message isn't very helpful. I'm just hoping somebody out there knows curses and has the answer. -- Ratfink -- http://mail.python.org/mailman/listinfo/python-list
Re: Problems with curses
> On Sat, 12 Jul 2008 20:49:56 -0400, Clay Hobbs wrote: > > > Unfortunately, the error message isn't very helpful. > > But it would be helpful to tell it. If you get exceptions, always > copy'n'paste the traceback here. People might know what the exception > means and share their wisdom. Here is the error message: Traceback (most recent call last): File "./text_adventure.py", line 25, in curses.wrapper(main) File "/usr/lib/python2.5/curses/wrapper.py", line 44, in wrapper return func(stdscr, *args, **kwds) File "./text_adventure.py", line 19, in main stdscr.scroll(3) _curses.error: scroll() returned ERR -- Ratfink -- http://mail.python.org/mailman/listinfo/python-list
How do I compare files?
I am making a program that (with urllib) that downloads two jpeg files and, if they are different, displays the new one. I need to find a way to compare two files in Python. How is this done? -- Ratfink -- http://mail.python.org/mailman/listinfo/python-list
Re: How do I compare files?
On Tue, 2008-07-22 at 17:29 -0700, Matimus wrote: > On Jul 22, 4:27pm, Clay Hobbs <[EMAIL PROTECTED]> wrote: > > I am making a program that (with urllib) that downloads two jpeg files > > and, if they are different, displays the new one. I need to find a way > > to compare two files in Python. How is this done? > > > > -- Ratfink > > Do you just want to check to see if they are the same? Or do you > actually want to know what the differences are? > > import urllib > > data1 = urllib.urlopen("http://url.of.jpg1";).read() > data2 = urllib.urlopen("http://url.of.jpg2";).read() > > if data1 == data2: > print "they are the same" > I just wanted to see if they are different. The code I was using that didn't work was almost the same, except that the lines that download the files didn't end in .read(). Thank you for your help -- Ratfink -- http://mail.python.org/mailman/listinfo/python-list
PyOpenGL Tutorial?
I need a tutorial for PyOpenGL (specifically, to be used with wxPython). I searched with Google and didn't find one. Does anybody know where one is? -- Ratfink -- http://mail.python.org/mailman/listinfo/python-list
Re: simple error i hope
On Fri, 2008-08-01 at 13:25 -0700, Emile van Sebille wrote: > suhail shaik wrote: > > > print fileName > > file = fileName.split(".") > .. this is a list > > you're shadowing a builtin -- generally a bad practice > > > print file > > textfile = file[0]+".txt" > > print textfile > > os.chdir(PNAME) > > file(textfile,'wt') > > .. and this is why > > > HTH, > > Emile > It is also a good idea to open files with the open() function and not the file() function. They do the exact same thing, and take the exact same parameters, just open() makes your code a bit more readable (or at least that's what I think). --Ratfink -- http://mail.python.org/mailman/listinfo/python-list
Re: Shared script
On Fri, 2008-08-01 at 14:41 -0700, Zach Hobesh wrote: > I wrote a script that several different people on different machines > need to run on a regular basis. When I first wrote it, it was in > crisis mode, I got something out that was quick and dirty, very bare > bones. Recently I had some more time, so I pushed most of the > functions that the script uses into a module, because I use those > functions on a pretty regular basis. > > My problem is this: > > The module is on MY machine in MY Python25 folder. I like it there, > because like I said, I use the functions within it on a pretty regular > basis. However, the other people who need to run the original script > don't have the module. My quick fix was to throw the module into the > shared folder, which works, but means everytime I have to update the > module I have to update 2 different files, the one in my Python25 > folder and the one in the shared network folder. Is there a better > way to do this, short of asking everybody else to put the module in > thir Python 25 folder (which would mean me e-mailing them to update > the module, and then assuming that they did) ?!? > > Thanks, > > Zach > You could just give the script and the module to the other people who use your script, and tell them to put the files in the same directory. I hope this could help you. --Ratfink -- http://mail.python.org/mailman/listinfo/python-list
RPM of a Python program
I want to make an RPM (Redhat Package Manager) file to install a Python program (not a module). How is this done? Does it use Distutils, or something completely different? Thanks in advance. -- Ratfink -- http://mail.python.org/mailman/listinfo/python-list
Some questions about PyOpenGL and wxPython
I am making a program with wxPython that renders objects in 3D using PyOpenGL, and I am having some problems. For one thing, I forgot how to make a double-buffered hardware surface. For another thing, glColor(1.0, 0.0, 0.0) just before the rendering doesn't make the object red. Please help, I'm a total noob to OpenGL. -- http://mail.python.org/mailman/listinfo/python-list
Re: [wxpython-users] ANN: wxPython 2.8.9.0
On Sun, 2008-09-28 at 12:01 -0700, Robin Dunn wrote: > Announcing > -- > > The 2.8.9.0 release of wxPython is now available for download at > http://wxpython.org/download.php. This release adds support for using > Cairo for drawing on wx windows, adds a Win64 build, and various other > fixes and enhancements. > > Source code is available, as well as binaries for Python 2.3, 2.4 and > 2.5, for Windows and Mac, as well some packages for various Linux > distributions. A summary of changes is listed below and also at > http://wxpython.org/recentchanges.php. > > > > What is wxPython? > - > > wxPython is a GUI toolkit for the Python programming language. It > allows Python programmers to create programs with a robust, highly > functional graphical user interface, simply and easily. It is > implemented as a Python extension module that wraps the GUI components > of the popular wxWidgets cross platform library, which is written in > C++. > > wxPython is a cross-platform toolkit. This means that the same program > will usually run on multiple platforms without modifications. > Currently supported platforms are 32-bit and 64-bit Microsoft Windows, > most Linux or other Unix-like systems using GTK2, and Mac OS X 10.4+. > In most cases the native widgets are used on each platform to provide > a 100% native look and feel for the application. > > > Changes in 2.8.9.0 > -- > > Many minor bug fixes throughout wxWidgets and wxPython. > > Fixed wx.lib.embeddedimage to work with Python 2.3. > > Fixed PseudoDC hit testing when pure white or pure black are used. > > Added support for a 64-bit Windows build for the AMD64 architecture, > (a.k.a. x64.) This is for Python 2.5 only and is available only as a > Unicode build. > > Added the wx.EmptyBitmapRGBA factory function. > > Added the wx.lib.wxcairo module which allows the pycairo package to be > used for drawing on wx window or memory DCs. In addition it is able > to convert from a native wx.Font to a cairo.FontFace, and it also > provides functions for converting to/from wx.Bitmap and > cairo.ImageSurface objects. In order to use this module you will need > to have the Cairo library and its dependencies installed, as well as > the pycairo Python package. For Linux and other unix-like systems you > most likely have what you need installed already, or can easily do so > from your package manager application. See the wx.lib.wxcairo > module's docstring for notes on where to get what you need for Windows > or Mac. This module uses ctypes, and depending on platform it may > need to find and load additional dynamic libraries at runtime in > addition to cairo. The pycairo package used needs to be new enough to > export the CAPI structure in the package namespace. I believe that > started sometime in the 1.4.x release series. > > Added the wx.lib.graphics module, which is an implementation of the > wx.GraphicsContext API using Cairo (via wx.lib.wxcairo). This allows > us to be totally consistent across platforms, and also use Cairo to > implement some things that are missing from the GraphicsContext API. > It's not 100% compatible with the GraphicsContext API, but probably > close enough to be able to share code between them if desired, plus it > can do a few things more. > > Updated wx.Bitmap.CopyFromBuffer to be a bit more flexible. You can > now specify the format of the buffer, and the CopyFromBufferRGBA is > now just a wrapper around CopyFromBuffer that specifies a different > format than the default. Also added the complement method, > CopyToBuffer. See the docstring for CopyFromBuffer for details on the > currently allowed buffer formats. The existing wx.BitmapFromBuffer > factory functions are also now implemented using the same underlying > code as CopyFromBuffer. > > Add wx.lib.mixins.listctrl.ListRowHighlighter for automatic highlighting > of rows in a wx.ListCtrl. > I'm curious, why do you package wxPython for Fedora 6 and 7, but not 8 and 9? --Ratfink -- http://mail.python.org/mailman/listinfo/python-list
PyOpenGL double-buffered hardware surface
How do I create a double-buffered hardware surface with PyOpenGL? I knew how to once, but forgot. --Ratfink -- http://mail.python.org/mailman/listinfo/python-list