My RPG Field Map Generator


This is for people who might want more script to examine and learn off of. I actually think this is very innovative and iffecient, I surprised myself greatly with this original script:

area_1.py
(Toggle Plain Text) from character_move import * ##import code shown in character_move.py from game_settings import * ##import video settings and image display functions def area_1(): character_location = ['',''] ##put where you want the character to start collision_1 = ['','','','',''] ##put the co-ordinates of the collision points in the format (rectangle or point), (x1), (y1), (x2), (y2) exclude the last two if you make the first one point collision_2 = ['','','','',''] collision_3 = ['','',''] collision_4 = ['','',''] collision_5 = ['','',''] collisions = [collision_1, collision_2, collision_3, collision_4, collision_5] ##if there are more collisions, add them in screen = video_settings() ##load the video settings to screen from the game_settings.py pygame.draw.rect(screen, (255, 255, 255), ( (250, 250), (550, 450) ), 0) ##create a white field in the space of the window character_location = character_move(screen, "area_map_1.bmp", character_location) ##enter the name of the picture for the areamap under "area_map_1.bmp" while 1: for event in pygame.event.get(): if event.type == KEYDOWN: c_o_l_l_i_s_i_o_n = check_collision(collisions, character_location, 0) if c_o_l_l_i_s_i_o_n == 0: if event.key == K_UP: character_location[1] = character_location[1] + 5 ##replace the values with the increments you want the character to move elif event.key == K_DOWN: character_location[1] = character_location[1] - 5 elif event.key == K_LEFT: character_location[0] = character_location[0] + 5 elif event.key == K_RIGHT: character_location[0] = character_location[0] - 5 c_o_l_l_i_s_i_o_n = check_collision(collisions, character_location, 0) if c_o_l_l_i_s_i_o_n == 1: if event.key == K_UP: character_location[1] = character_location[1] - 5 elif event.key == K_DOWN: character_location[1] = character_location[1] + 5 elif event.key == K_LEFT: character_location[0] = character_location[0] - 5 elif event.key == K_RIGHT: character_location[0] = character_location[0] + 5 character_location = character_move(screen, "area_map_1.bmp", character_location) #print character_location #area_1() from character_move import * ##import code shown in character_move.py from game_settings import * ##import video settings and image display functions def area_1(): character_location = ['',''] ##put where you want the character to start collision_1 = ['','','','',''] ##put the co-ordinates of the collision points in the format (rectangle or point), (x1), (y1), (x2), (y2) exclude the last two if you make the first one point collision_2 = ['','','','',''] collision_3 = ['','',''] collision_4 = ['','',''] collision_5 = ['','',''] collisions = [collision_1, collision_2, collision_3, collision_4, collision_5] ##if there are more collisions, add them in screen = video_settings() ##load the video settings to screen from the game_settings.py pygame.draw.rect(screen, (255, 255, 255), ( (250, 250), (550, 450) ), 0) ##create a white field in the space of the window character_location = character_move(screen, "area_map_1.bmp", character_location) ##enter the name of the picture for the areamap under "area_map_1.bmp" while 1: for event in pygame.event.get(): if event.type == KEYDOWN: c_o_l_l_i_s_i_o_n = check_collision(collisions, character_location, 0) if c_o_l_l_i_s_i_o_n == 0: if event.key == K_UP: character_location[1] = character_location[1] + 5 ##replace the values with the increments you want the character to move elif event.key == K_DOWN: character_location[1] = character_location[1] - 5 elif event.key == K_LEFT: character_location[0] = character_location[0] + 5 elif event.key == K_RIGHT: character_location[0] = character_location[0] - 5 c_o_l_l_i_s_i_o_n = check_collision(collisions, character_location, 0) if c_o_l_l_i_s_i_o_n == 1: if event.key == K_UP: character_location[1] = character_location[1] - 5 elif event.key == K_DOWN: character_location[1] = character_location[1] + 5 elif event.key == K_LEFT: character_location[0] = character_location[0] - 5 elif event.key == K_RIGHT: character_location[0] = character_location[0] + 5 character_location = character_move(screen, "area_map_1.bmp", character_location) #print character_location #area_1()
Posted On: Friday 28th of December 2012 05:25:29 AM Total Views:  202
View Complete with Replies

RELATED TOPICS OF Python Programming PROGRAMMING LANGUAGE




Instructions on how to build py2exe 0.6.8 (or an installer would benice, too!)

, I'm trying to build an executable with py2exe, but unfortunately the version I have is 0.6.6, which has a rather annoying bug that doesn't let you rename the executable file if you bundle everything in a single executable. It seems fairly unacceptable to tell our customers that they can't rename a file we send them. I hear this problem is fixed in 0.6.8, but unfortunately there's no standalone installer for py2exe 0.6.8 - the most recent version that has an installer is 0.6.6 way back from 2006 (!). Is there a standalone installer for py2exe 0.6.8 anywhere If not, how do I build it from source (There's no instructions in the readme - it just says "How to install: download the standalone installer" and doesn't include building instructions.) Cheers, Evan
VIEWS ON THIS POST

127

Posted on:

Wednesday 7th November 2012
View Replies!

March meeting minutes available

The following minutes were approved at a meeting of the PSF Board of Directors on April 14, 2008: * PSF Board meeting, March 10, 2008: http://www.python.org/psf/records/bo...es/2008-03-10/ * PSF Members' Meeting, March 14, 2008: http://www.python.org/psf/records/members/2008-03-14/ * PSF Board meeting, March 14, 2008 (first meeting of the newly elected Board of Directors, at PyCon): http://www.python.org/psf/records/bo...es/2008-03-14/ David Goodger, PSF Secretary -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.8 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEAREDAAYFAkgEpmYACgkQrqIPjB1FxosjDgCgoi6pCIUGI1iC5CY7aFzDZOii FpIAn2wXTvd16LwTAyP082EmqYdbBYSd =e5zi -----END PGP SIGNATURE-----
VIEWS ON THIS POST

40

Posted on:

Wednesday 7th November 2012
View Replies!

Re: Running a python code periodically

Maryam Saeedi schrieb: > > > I was wondering if you know how can I run a python code once every five > minutes for a period of time either using python or some other program like > a bash script. See the sched module in the standard library or here: http://pypi.python.org/simple/Recur/ cheers Paul
VIEWS ON THIS POST

50

Posted on:

Wednesday 7th November 2012
View Replies!

ANN: Leo 4.4.8 final

Leo 4.4.8 final is now available at: http://sourceforge.net/project/showf...ckage_id=29106 This version features a new ipython plugin that provides a two-way bridge between Leo and IPython. See http://webpages.charter.net/edreamle...honBridge.html Leo is a text editor, data organizer, project manager and much more. See: http://webpages.charter.net/edreamleo/intro.html The highlights of Leo 4.4.8: ---------------------------- - Leo's source code is now managed by bzr: see link below. - Leo's discussion is now hosted by Google Groups: see link below. - Arguments to g.es and g.es_print can be translated using gettext. - Completed ILeo: a bridge between IPython and Leo. See http://webpages.charter.net/edreamle...honBridge.html - Minibuffer commands may have arguments. - @menu trees can now refer to commands created by @command and @button nodes. - Added support for common @commands nodes in settings files. Links: ------ Leo: http://webpages.charter.net/edreamleo/front.html Forum: http://groups.google.com/group/leo-editor Download: http://sourceforge.net/project/showf...group_id=3458 Bzr: http://code.launchpad.net/leo-editor/ Quotes: http://webpages.charter.net/edreamleo/testimonials.html -------------------------------------------------------------------- Edward K. Ream email: edreamleo@yahoo.com Leo: http://webpages.charter.net/edreamleo/front.html --------------------------------------------------------------------
VIEWS ON THIS POST

38

Posted on:

Wednesday 7th November 2012
View Replies!

How to convert latex-based docs written with Python 2.5 to 2.6 framework

HI! I had a look on how Doc/ is organized with Python 2.6. There are files with suffix .rst. Hmm... I'm maintaing existing docs for python-ldap which I might have to convert to the new concept in the long run. What's the recommended procedure for doing so Any pointer Ciao, Michael.
VIEWS ON THIS POST

77

Posted on:

Wednesday 7th November 2012
View Replies!

Re: GUI toolkits with Tkinter's .pack() alternative

Guilherme Polo wrote: > 2008/3/26, Alex9968 : > >> Hi all, >> >> I use Tkinter's Pack widget geometry manager (I really prefer it over >> using visual GUI designers), so my question is which other GUI toolkits >> have similar functionality. >> > > The geometry manager isn't related to using GUI designers tools at > all. And each toolkit has it's own way to do the things, wxPython uses > sizers, PyGtk uses containers. > Well, the geometry manager isn't *directly* related to using GUI designers, but as Pack arranges widgets automatically, using GUI designers isn't required, while with geometry managers that don't, GUI designers are necessary (if you start placing widgets programmatically, you'll end up reinventing something like Tkinter's Pack or Grid geometry manager). I hope I can be understood clearly this time ;-) >> Secondly, I like the detailed widget borders configuration possible in >> Tkinter, which can be used to tweak GUI look, and wonder if other >> toolkits support it. With Tkinter's case, I like the resulting (tweaked) >> look in Windows, but I'm afraid it can be quite different (and ugly) on >> other platforms. >> > > You sure can, but differently. > I suppose any toolkit allows setting parameters like "no border", "flat border" and "3d border", but which ones can set ANY type of border to ANY widget like Tkinter does For example set GROOVE border to buttons and text widgets (instead of traditional wide raised/lowered borders), which is cool (in my opinion). > >> (The reason I ever consider moving from Tkinter is some inconveniences, >> involving for example window scrolling, plus its smaller amount of >> widgets compared to some other toolkits, plus its (rumored) ugly look on >> certain environments. I will not necessary change the toolkit, but I >> have to consider it) >> >> > > I'm planning to "solve" this, I'm suggesting inclusion of Ttk into > Tkinter for upcoming GSoC. For now you could try using Tile extension, > and update to Tk 8.5. If you don't want to use extensions, then you > will have to wait or change the toolkit for now. >
VIEWS ON THIS POST

60

Posted on:

Wednesday 7th November 2012
View Replies!

can't set attributes of built-in/extension type

I'm working on a simple extension. Following the classic 'noddy' example. In [15]: cmplx_int32 Out[15]: Now I want to add an attribute to this type. More precisely, I want a class attribute. cmplx_int32.test = 0 --------------------------------------------------------------------------- TypeError Traceback (most recent call last) /home/nbecker/numpy/ in () TypeError: can't set attributes of built-in/extension type 'numpy.cmplx_int32' What am I missing
VIEWS ON THIS POST

82

Posted on:

Wednesday 7th November 2012
View Replies!

Difference between del and remove?

Got a quick n00b question. What's the difference between del and remove
VIEWS ON THIS POST

117

Posted on:

Wednesday 7th November 2012
View Replies!

Re: Newbie edit/compile/run cycle question

--- Jeremy C B Nicoll wrote: > Steve Howell wrote: > > > There are a zillion powerful editors out there. > I've > > been productive in EditPlus, MultiEdit, SlickEdit, > > vim, and emacs, just to throw out a few examples. > > What command (in XP) does one need to issue to > syntax check a saved python > script without running it > Perhaps oversimplifying a bit, running "python" does a syntax check, and if it passes, moves on the next steps of interpretation/execution. > Does a syntax check report all syntax errors or just > the first one found > Just the first one. In practice, you end up fixing them one at a time anyway, so this works for me, as long as I have a fluid way to call out to python and return to the editor. ____________________________________________________________________________________ Looking for last minute shopping deals Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsea...egory=shopping , Simon Forman wrote: > On Dec 8, 6:45 pm, Jeremy C B Nicoll wrote: > > Ah, I've been using IDLE so far (but would probably prefer to write > > Python in my normal text editor). In IDLE Alt-X syntax checks the saved > > copy of the file being edited (at least it seems to), and I was > > wondering how to replicate that elsewhere. > > I don't know of a command line tool to do that, but I hasten to point > out that you have the source code of IDLE available so you could just > figure out what it's doing and encapsulate that in a script. I was afraid someone would suggest that. Figuring out how IDLE works is a bit beyond me at this stage. I note the idea posted by Jan Claeys involves running a working python program which manages the compile process, which is an approach I'd not have thought of in a hurry. My experience of other languages' compilers has never been like this, eg to compile a Fortran program I would not expect to run a Fortran program that calls the compiler, IYSWIM. -- Jeremy C B Nicoll - my opinions are my own.
VIEWS ON THIS POST

69

Posted on:

Wednesday 7th November 2012
View Replies!

ANN: pyglet 1.0beta1

Greetings I am pleased to announce the first public beta of pyglet, a cross-platform windowing and multimedia package useful for developing games and other visually-rich applications. http://www.pyglet.org pyglet is written entirely in Python, with no external requirements needed to develop applications for Windows XP, Mac OS X or Linux. pyglet allows applications to open any number of top-level windows and draw into them using the OpenGL API. Multiple-monitor setups are well-supported. Applications using pyglet can also play sound and music samples in surround-sound, taking advantage of hardware acceleration where available. With the addition of a single DLL based on FFmpeg, applications can read compressed sound and video in many formats. pyglet is provided under the BSD open-source license, allowing you to use it for both commercial and other open-source projects with very little restriction. Cheers, Alex.
VIEWS ON THIS POST

48

Posted on:

Wednesday 7th November 2012
View Replies!

PyObject sanitizer (CPython 2.4.4)

I get this from valgrind (no suppression file but thgis probably is not covered by the suppressor anyway): ==6108== Invalid read of size 4 ==6108== at 0x48D19F4: lookdict_string (dictobject.c:359) ==6108== by 0x48D1B59: PyDict_GetItem (dictobject.c:554) ==6108== by 0x48B1657: instance_getattr2 (classobject.c:741) ==6108== by 0x48B701D: instance_getattr1 (classobject.c:725) ==6108== by 0x48B2670: instance_getattr (classobject.c:764) ==6108== by 0x48D6500: PyObject_GetAttr (object.c:1088) ==6108== by 0x48D6355: PyObject_GetAttrString (object.c:1031) so i wonder if the PyObject i gave to PyObject_GetAttrString to gnaw on is in good shape. is assert(obj->ob_refcnt>0); a good way to check if i'm dealing with a valid PyObject or there is a helper that can do this for me
VIEWS ON THIS POST

26

Posted on:

Wednesday 7th November 2012
View Replies!

troll vs. trawl [was: Re: list index()]

On Fri, Aug 31, 2007 at 10:27:34AM +0100, Richie Hindle wrote: > > [Carsten] > > .................. If we start labeling > > people, this thread will earn you a label that rhymes with "roll". > > [Hendrik] > > weird this - maybe a native English speaker can comment - > > when I pronounce what fishermen do - it rhymes with roll, > > but when I am talking about the thing that lives under bridges > > and munches goats, the "O" sound is shorter, and more > > towards the back of my mouth. > > But - the word for someone who posts to the internet with the intention of > stirring up trouble derives from the word for what fishermen do, not from > the word for something that lives under a bridge. It derives from "trolling > for suckers" or "trolling for newbies". Many thesauri list the 'troll' as a synonym of 'trawl'. Given their etymologies... 1. 'trawl' is 'probably from L. tragula "dragnet."' -- 2. troll (v.) 1377, "to go about, stroll," later (c.1425) "roll from side to side, trundle," from O.Fr. troller, a hunting term, "wander, to go in quest of game without purpose," from a Gmc. source (cf. O.H.G. trollen "to walk with short steps"), from P.Gmc. *truzlanan. Sense of "sing in a full, rolling voice" (first attested 1575) and that of "fish with a moving line" (1606) are both extended technical applications of the general sense of "roll, trundle," the latter perhaps confused with trail or trawl. Fig. sense of "to draw on as with a moving bait, entice, allure" is from 1565. Meaning "to cruise in search of sexual encounters" is recorded from 1967, originally in homosexual slang. -- .... it was probably inevitable that 'troll' and 'trawl' become synonymous. David > -- > Richie Hindle > richie@entrian.com
VIEWS ON THIS POST

48

Posted on:

Wednesday 7th November 2012
View Replies!

using super() to call two parent classes __init__() method

When I run the following code and call super() in the Base class's __init__ () method, only one Parent's __init__() method is called. class Parent1(object): def __init__(self): print "Parent1 init called." self.x = 10 class Parent2(object): def __init__(self): print "Parent2 init called." self.y = 15 class Base(Parent1, Parent2): def __init__(self): super(Base, self).__init__() self.z = 20 b = Base() --output:-- Parent1 init called.
VIEWS ON THIS POST

123

Posted on:

Wednesday 7th November 2012
View Replies!

amra and py2exe

Hi i am having trouble creating exe using py2exe for amara package i saw some posts related to this talking about amara cat file but i dont have any cat file for amara on my machine. the standalone script runs fine. i am using python on windows here is the error i am getting while creating the exe The following modules appear to be missing ['amara', 'ext.IsDOMString', 'ext.SplitQName'] can anybody please help me with this
VIEWS ON THIS POST

99

Posted on:

Wednesday 7th November 2012
View Replies!

HTTPS request

Hi , I want to send HTTPs put request to the server .Can any one help me how to do that . I am using this code import httplib from group import * class HTTPS: def __init__(self,ip,port=443): self.ip=ip self.port=port self.conn = httplib.HTTPSConnection(str(self.ip)) def send_request(self,method,uri,data=None,headers=None): self.conn.request(method,uri,data,headers) if __name__=="__main__" http_obj=HTTPS('10.51.26.203') headers={"Content-type": "application/auth-policy+xml","Accept": "text/plain"} data="some xml doc" http_obj.send_request('PUT',uri,data,headers=headers) But it dumps core where ever i run this.Please tell me where i am going wrong.
VIEWS ON THIS POST

102

Posted on:

Wednesday 7th November 2012
View Replies!

Comparing RFC1123 based Dates

I would like to parse RFC 1123 date format and compare two dates. I find that datetime module does not specifically confirms to any RFC. Any suggestions as how I can handle the RFC 1123 date format using standard libraries before I go to re based parsing
VIEWS ON THIS POST

36

Posted on:

Wednesday 7th November 2012
View Replies!

Utilizing a raw IDispatch Pointer from Python

I have a C++ application that creates a collection of COM objects. I would like to give the Python interpreter access to these interfaces that were created in C++ land. Stated another way, how can I have Python consume a IDispatch pointer from C++ and wrap it with one of those nice Python classes automatically
VIEWS ON THIS POST

24

Posted on:

Wednesday 7th November 2012
View Replies!

Resize image NO PIL!!

I have created an image hosting site and when a user uploads an image, I want a service to run on the server to create a few thumbnails while the user does other things. My stupid host (pair.com) doesn't have PIL installed and I'm too much of a stupid newbie to figure out how to get it to work with them (access denied while installing it, of course). Also, they don't have any python interface setup for GD. Anyway, I don't know what my options are. I'm thinking: 1) Find another host with mod_python, PIL, and other Python goodies 2) use PHP to create the thumbnails 3) Open the images into a buffer and try to do the calculations myself I'm thinking I might have to go with 1. I want the script to run as a service so I don't know how well number 2 would work and I certainly don't want number 3 (on a time-line here). Any suggestions
VIEWS ON THIS POST

60

Posted on:

Wednesday 7th November 2012
View Replies!

EP2006 timetable + reduced registration

Hi Pythonistas! EuroPython 2006 is nearing and there is much good news! We have a very nice program of over 100 interesting talks (sorry that we had to reject some), see here for yourself: http://www.europython.org/timetable Also we have slots for 50 lightning (5 minute) talks so be sure to prepare one and register at the conference. We have also secured Alan Kay (the inventor of OO languages, Smalltalk, opencroquet.org etc.) as a key note speaker and are happy that Guido van Rossum will make it again! But best of all, the voluntary organisers have decided to give you another chance to register for a reduced fee -- but only until this weekend, so hurry and register: http://www.europython.org/sections/registration_issues If you have questions then mail to europython@python.org or come to #europython on irc.freenode.net. See you there, or in fact here: http://www.europython.org/venue.jpg Cheers, mwh & holger (on behalf of the EuroPython organizers) -- ZAPHOD: OK, so ten out of ten for style, but minus several million for good thinking, eh -- The Hitch-Hikers Guide to the Galaxy, Episode 2
VIEWS ON THIS POST

115

Posted on:

Wednesday 7th November 2012
View Replies!

Re: Seventh version of Python Director available

Argh. Always include the URL. The code is available from http://pythondirector.sourceforge.net/ >>> Anthony Baxter wrote > I'm happy to announce the seventh release of Python Director. > > Python Director is a pure python TCP load balancer. It takes > inbound TCP connections and connects them to one of a number > of backend servers. > > Despite the version numbering (which looks scary), this is quite > mature software - it's been in heavy use for well over 12 months, > balancing FastCGI and HTTP connections to our backend Zope > servers. > > Features: > > * async i/o based, so much less overhead than fork/thread based > balancers. Can use either twisted or python's standard asyncore > library (twisted is recommended, and asyncore support will be > removed in a future version). > > * Multiple scheduling algorithms (random, round robin, leastconns, > leastconns+roundrobin) > > * If a server fails to answer, it's removed from the pool - the client > that failed to connect gets transparently failed over to a new host. > > * xml based configuration file > > * seperate management thread that periodically re-adds failed hosts if > they've come back up. > > * optional builtin webserver for admin > > * webserver has methods suitable for both interactive and automated > systems > > > > Changes from 0.0.6 to 0.0.7 > > - You can specify a hostname of '*' to the listen directive for both > the scheduler and the administrative interface to mean 'listen on > all interfaces'. Considerably more obvious than '0.0.0.0'.
VIEWS ON THIS POST

67

Posted on:

Wednesday 7th November 2012
View Replies!

Python 2.3 for RISC OS

============================================================================ Python 2.3 for RISC OS release 2003-08-03 ============================================================================ I'm pleased to announce that binaries of Python 2.3 for RISC OS are available from http://www.schwertberger.de/python.html . RISC OS Python includes the following highlights: * An integrated interface to the SWI system * Drawfile support * Interfaces to the RISC OS WIMP and toolbox (with examples) * Numeric extension * PeerBoard: share your clipboard contents between multiple RISC OS and win32 computers over TCP/IP connections * SSLRelay: a simple SSL proxy server For use of Python you will need a filing system with long filename and >77 files/directory support. Bug reports etc. ================ RISC OS specific bug reports, contributions, comments, critics, links to RISC OS compatible Python libraries to dietmar@schwertberger.de
VIEWS ON THIS POST

47

Posted on:

Wednesday 7th November 2012
View Replies!

Python 2.5.1 can't find win32file?

I just upgraded from 2.4.something to 2.5.1. I get the stuff below. I tried easy-installing pywin32; same results. Anyone know what's going on Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit (Intel)] on win32 Type "copyright", "credits" or "license()" for more information. **************************************************************** Personal firewall software may warn about the connection IDLE makes to its subprocess using this computer's internal loopback interface. This connection is not visible on any external interface and no data is sent to or received from the Internet. **************************************************************** IDLE 1.2.1 ==== No Subprocess ==== >>> import win32file Traceback (most recent call last): File "", line 1, in import win32file ImportError: DLL load failed: The specified module could not be found. >>> import sys >>> sys.path ['C:\\Documents and Settings\\dentos\\Desktop\\scripting', 'C:\ \Python25\\Lib\\idlelib', 'C:\\Python25\\lib\\site-packages\ \setuptools-0.6c6-py2.5.egg', 'C:\\Python25\\lib\\site-packages\ \sqlalchemy-0.3.10-py2.5.egg', 'C:\\Python25\\lib\\site-packages\ \pil-1.1.6-py2.5-win32.egg', 'C:\\Python25\\lib\\site-packages\ \epydoc-3.0beta1-py2.5-win32.egg', 'C:\\Python25\\lib\\site-packages\ \pywin32-210-py2.5-win32.egg', 'C:\\WINNT\\system32\\python25.zip', 'C: \\Python25\\DLLs', 'C:\\Python25\\lib', 'C:\\Python25\\lib\\plat-win', 'C:\\Python25\\lib\\lib-tk', 'C:\\Python25', 'C:\\Python25\\lib\\site- packages']
VIEWS ON THIS POST

85

Posted on:

Wednesday 7th November 2012
View Replies!

Re: merge two ranges

On Jul 17, 1:29 pm, anoweb wrote: > I have two ranges of numbers and I need to determine if they overlap > or adjacent and if so return a new range containing the values. The > values are low and high for each pair, such that the first value of > the tuple is always less than or equal to the second value in the > tuple. > > for example: > a = (0, 5) > b = (5, 10) > > print getAdjacent(a, b) # output: (0, 10) > print getAdjacent(b, a) # output: (0, 10) > print getOverlap(a, b) # output: None > print getOverlap(b, a) # output: None > > a = (0, 7) > b = (3, 10) > print getAdjacent(a, b) # output: None > print getAdjacent(b, a) # output: None > print getOverlap(a, b) # output: (0, 10) > print getOverlap(b, a) # output: (0, 10) > > a = (0, 90) > b = (5, 10) > print getAdjacent(a, b) # output: None > print getAdjacent(b, a) # output: None > print getOverlap(a, b) # output: (0, 90) > print getOverlap(b, a) # output: (0, 90) > > a = (0, 5) > b = (12, 20) > print getAdjacent(a, b) # output: None > print getAdjacent(b, a) # output: None > print getOverlap(a, b) # output:None > print getOverlap(b, a) # output: None > > any easy way of doing this It's not really hard to come up with a quick and dirty solution; however if this isn't a homework or a toy program, take a look at the interval module (http://cheeseshop.python.org/pypi/interval/1.0.0) for a more thought-out design. HTH, George
VIEWS ON THIS POST

50

Posted on:

Saturday 10th November 2012
View Replies!

Python Help!!!

I'm trying to make a program that reads Fasta file and print it out. I used the SeqIO module and the results is: 'ATGGTCAT....SingleAlphabet()' For this purpose, should I use SeqIO or Fasta for example: from Bio import SeqIO or ...
VIEWS ON THIS POST

31

Posted on:

Saturday 10th November 2012
View Replies!

RELEASED Python 2.4.4, Final.

On behalf of the Python development team and the Python community, I'm happy to announce the release of Python 2.4.4 (FINAL). Python 2.4.4 is a bug-fix release. While Python 2.5 is the latest version of Python, we're making this release ...
VIEWS ON THIS POST

37

Posted on:

Saturday 10th November 2012
View Replies!

[ANN] Release 0.15 of Task Coach - Your friendly task manager

I'm happy to announce the release of version 0.15 of Task Coach. This is the second public release and hopefully Task Coach is now more portable. Functionality is largely the same in comparison with the previous release. I'm specifically solliciting ...
VIEWS ON THIS POST

44

Posted on:

Saturday 10th November 2012
View Replies!

Problems with joining Unicode strings

, I have problems with joining strings. My program get web page fragments, then joins them into one single web page. I have error when I try to join these fregments : "UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in ...
VIEWS ON THIS POST

54

Posted on:

Saturday 10th November 2012
View Replies!

Re: embedded python in c++ packaging

En Thu, 07 Feb 2008 16:18:57 -0200, Joshua Kugler escribi: > Furkan Kuru wrote: >> >> I have been developing an application in C++ that embeds Python >> interpreter. It takes advantage of too many modules from Python. >> ...
VIEWS ON THIS POST

154

Posted on:

Saturday 10th November 2012
View Replies!

Is unicode.lower() locale-independent?

The section on "String Methods"[1] in the Python documentation states that for the case conversion methods like str.lower(), "For 8-bit strings, this method is locale-dependent." Is there a guarantee that unicode.lower() is locale-*in*dependent The section on "Case Conversion" in PEP ...
VIEWS ON THIS POST

57

Posted on:

Saturday 10th November 2012
View Replies!

cmp and sorting non-symmetric types

(I've had trouble getting response for collaboration on a PEP. Perhaps I'm the only interested party) Although py3k raises an exception for completely unsortable types, it continues to silently do the wrong thing for non-symmetric types that overload comparison operator ...
VIEWS ON THIS POST

54

Posted on:

Saturday 10th November 2012
View Replies!

how to find position of dictionary values

hi, i have a dictionary as follows : kev : {'phno': ['dgsd', 'gsdg', 'dfsdf', 'g'], 'email': ['dg', 'sgsd', 'sdfsdf', 'gdf'], 'name': ['ds', 'dsg', 'dsfds', 'fgdf'], 'address': ['sdg', 'dsgsdg', 'sdf', 'dfg']} if user is enters the 3rd item of key phno, ...
VIEWS ON THIS POST

79

Posted on:

Sunday 11th November 2012
View Replies!

Inheritance crossover packages

group, I'm having a seemingly simple problem. I want to generate a hierarchy of modules, like this one: GenerationScripts/ GenerationScripts/dhcp GenerationScripts/bind9 And the files: GenerationScripts/dhcp/__init__.py GenerationScripts/bind9/generator.py GenerationScripts/bind9/__init__.py GenerationScripts/mastergen.py GenerationScripts/__init__.py packages (bind9, dhcp) should inherit from the master generator ...
VIEWS ON THIS POST

43

Posted on:

Sunday 11th November 2012
View Replies!

Re: Any reliable obfurscator for Python 2.5

En Sun, 20 Apr 2008 10:32:36 -0300, Banibrata Dutta escribi: > On 4/20/08, Gabriel Genellina wrote: >> >> En Sun, 20 Apr 2008 01:55:51 -0300, Banibrata Dutta < >> banibrata.dutta@gmail.com > escribi: >> >> > Wanted to check ...
VIEWS ON THIS POST

72

Posted on:

Sunday 11th November 2012
View Replies!

Extracting files from an ISO image?

Hi all, My kids have a bunch of games that have to be run from CD (on Windows XP). Now they're not very careful with them, and so I have a plan. I've downloaded a utility (Daemon Tools) which allows ...
VIEWS ON THIS POST

36

Posted on:

Monday 12th November 2012
View Replies!

Re: Retrieving http headers from HTTPConnection object

On Mon, Sep 1, 2008 at 1:06 PM, jorma kala wrote: > > > when using httplib for http requests, like for example: > > > conn = httplib.HTTPConnection("www.python.org") > conn.request("GET", "/index.html") > > Is it possible to ...
VIEWS ON THIS POST

32

Posted on:

Sunday 25th November 2012
View Replies!

MethodChain

Found from Reddit, it's for e ECMA(Java)Script, but something similar may be useful for Python too: http://jsclass.jcoglan.com/methodchain.html http://blog.jcoglan.com/2008/07/16/w...rself-clearly/ Bye, bearophile...
VIEWS ON THIS POST

49

Posted on:

Sunday 25th November 2012
View Replies!

How to bypass Windows 'cooking' the I/O? (One more time, please) II

I know I saw the answer recently, as in since February '08, but I can't re-find it. I tried the mail archives and such and my own collections but the piece I saw still eludes me. Problem: (sos=same old s...) ...
VIEWS ON THIS POST

101

Posted on:

Sunday 25th November 2012
View Replies!

Re: warning for unused packages/modules/objects

Daniel Fetchinson wrote: > How difficult would it be to implement a system in python that would > warn if there are unnecessarily imported packages/modules/objects in > the code I mean that when developing some code one frequently imports > ...
VIEWS ON THIS POST

61

Posted on:

Sunday 25th November 2012
View Replies!

Start a new discussion

Have a good day. http://www.homedecors2.blogspot.com/...
VIEWS ON THIS POST

46

Posted on:

Sunday 25th November 2012
View Replies!

Looking for some good python learning resources on the web

What are the best sites to read to learn python...
VIEWS ON THIS POST

92

Posted on:

Sunday 25th November 2012
View Replies!

Best way to store config or preferences in a multi-platform way.

python beginner starting a new project here. This project will store most of its actual data in a shared-database, but I have a small amount of user specific data that I need to be stored like configuration or preferences ...
VIEWS ON THIS POST

56

Posted on:

Sunday 25th November 2012
View Replies!

New to group

Hi Everyone I am new to programming in general although I have read alot and done alot of experimentation as well as researched afew languages namely java python and visual basic . My conclusion is that python is one of ...
VIEWS ON THIS POST

27

Posted on:

Sunday 25th November 2012
View Replies!

Article of interest: Python pros/cons for the enterprise

This is part of a series examining the strengths and weaknesses of various scripting languages, with particular attention to enterprise (read: big company) use. You Used Python to Write WHAT Python is a powerful, easy-to-use scripting language suitable for use ...
VIEWS ON THIS POST

70

Posted on:

Sunday 25th November 2012
View Replies!

python based BB system

I have been searching for a while for a complete and fast Bulletin Board System for a mature community. any recommendation ...
VIEWS ON THIS POST

72

Posted on:

Sunday 25th November 2012
View Replies!

Email module, how to add header to the top of an email?

I have been using the Email module and Message class for awhile, however I have been unable to find a way to add a header to the top of the email similar to what is done with Received: headers... the ...
VIEWS ON THIS POST

29

Posted on:

Sunday 25th November 2012
View Replies!

fiber(cooperative multi-threading)

Hi all. I found cooperative multi-threading(only one thread runs at once, explicit thread switching) is useful for writing some simulators. With it, I'm able to be free from annoying mutual exclusion, and make results deterministic. For this purpose, and inspired ...
VIEWS ON THIS POST

72

Posted on:

Monday 26th November 2012
View Replies!

Python module written in C compiles properly but returns wrong value

I created a Python module in C, just as a test, that defines a function addTwoNumbers(x,y) == x+y c Syntax (Toggle Plain Text) #include "Python.h"static PyObject *addTwoNumbers(PyObject *self, PyObject *args){ const int one; const int two; int sum; if (!PyArg_ParseTuple(args, "ii",one, two)) return NULL; sum = one + two; return Py_BuildValue("i", sum);}static PyMethodDef methods[] = { {"addTwoNumbers", addTwoNumbers, METH_VARARGS, "Returns the sum of two numbers as an integer"}, {NULL, NULL, 0, NULL}};PyMODINIT_FUNCinitaddTwoNumbers(){ (void) Py_InitModule("addTwoNumbers", methods);} #include "Python.h" static PyObject * addTwoNumbers(PyObject *self, PyObject *args) { const int one; const int two; int sum; if (!PyArg_ParseTuple(args, "ii",one, two)) return NULL; sum = one + two; return Py_BuildValue("i", sum); } static PyMethodDef methods[] = { {"addTwoNumbers", addTwoNumbers, METH_VARARGS, "Returns the sum of two numbers as an integer"}, {NULL, NULL, 0, NULL} }; PyMODINIT_FUNC initaddTwoNumbers() { (void) Py_InitModule("addTwoNumbers", methods); }
VIEWS ON THIS POST

37

Posted on:

Tuesday 27th November 2012
View Replies!

Retrieving selected text from outside.

The short answer is that what you are trying to do is virtually impossible.
VIEWS ON THIS POST

46

Posted on:

Tuesday 27th November 2012
View Replies!

List permutations?

How would you go about doing list permutations in python I've seen permutations in C++, C, and Java. but I wanna see what it looks like in python
VIEWS ON THIS POST

44

Posted on:

Tuesday 27th November 2012
View Replies!

classes in python?

Hi , when I was programming with C++ years ago I remember making classes I think where for example I could make a class saying fish and then list all the types of fish. Then make another type called dogs, and list all the dogs ect so the program would work something like. animal = input('Enter the name of the animal you want to find out ') Then if they typed in for example 'carp' it would say that animal is a fish. I know exactly in my head how to do it but just not in the python language lol.
VIEWS ON THIS POST

45

Posted on:

Wednesday 28th November 2012
View Replies!