244 Posted Topics

Member Avatar for leegeorg07

To use the functions that a module contains, you need to import them first, like Aia showed. Option #1: [code=python] import math math.sqrt( x ) [/code] And option #2 (to import [i]all[/i] functions from math): [code=python] from math import * sqrt( x ) [/code]

Member Avatar for shadwickman
0
92
Member Avatar for kruglok

I'd personally suggest using wxPython if you haven't chosen a GUI package yet. You'd just need a TextCtrl for the name, a set of CheckBoxes for the different toppings, and a 2 RadioButtons for the choice of bun (so only 1 can be selected), and then a Button which executes …

Member Avatar for shadwickman
0
142
Member Avatar for mckillmt

I've used Panda3D, but never much more than tweaking shaders and such. However, it sounds like you're going to need to make a basic algorithm to calculate the movement for the monster, then apply it to the monster so that it continually finds a path leading to the knight and …

Member Avatar for shadwickman
0
90
Member Avatar for shadwickman

Hi, I didn't really know how to word the title, but I was just wondering if it was possible to write a function and make it accessible as if it was any other str function. It was a simple (but useful) few lines which returned a list of all the …

Member Avatar for shadwickman
0
160
Member Avatar for shadwickman

Hi, I have a GUI written with wxPython that contains a form. When the button is clicked, a script is executed to cycle through a specified directory and resize the images to a 50% size (the image manipulation is done with PIL). I used to run this script via the …

Member Avatar for shadwickman
0
145
Member Avatar for CrunchyRoll

I was going to suggest using Python + wxPython to make a text editor like Notepad or Wordpad. But you don't know Python right?

Member Avatar for shadwickman
0
143
Member Avatar for kiddo39

I can try to help with #2. First, change im, im1, im2, etc to strings, so that the command for im looks like [icode]im = "image.crop(box)"[/icode]. The value should be a string. When you want to call that specific command use [icode]exec im1[/icode] etc for each command.

Member Avatar for kiddo39
0
112
Member Avatar for riconeill
Member Avatar for BmeEng

Can you please put your code in python CODE tags so it has syntax highlighting, but most importantly indentation. Seeing as Python requires indentation, and the above has none, it's hard to sort through at the moment.

Member Avatar for BmeEng
0
167
Member Avatar for tomtetlaw

Can you please edit the post and put the code within CODE tags? Otherwise indentation gets lost, and as you know, identation is crucial in Python. (And as a quick tip, you might want to make a base class for all weapons, and then have individual weapon classes extend that …

Member Avatar for tomtetlaw
0
2K
Member Avatar for lllllIllIlllI

All I was able to find was this article, but from what it says, it sounds risky as each platform/distro is quite different and difficult. [url]http://lists.wxwidgets.org/pipermail/wxpython-users/2007-March/062720.html[/url]

Member Avatar for lllllIllIlllI
0
94
Member Avatar for Stefano Mtangoo

I use Notepad++ when programming Python with Windows, and I use plain old gedit when I'm programming Python on Ubuntu.

Member Avatar for mathijs
0
240
Member Avatar for iamoldest

The % operator is used to return the remainder if one number were to be divided by another. So 5 % 2 would return 1, because 2 goes into 5 twice, with 1 left over. Another example is 10 % 2 which would return 2. 4 goes in twice, with …

Member Avatar for jlm699
0
102
Member Avatar for pyth0n

I don't know if there's a "proper" method of doing this, but I have the code look something like this: [code=python] # function to call def myFunction(): print "code here" return True # main program redo = True while redo == True: redo = myFunction() # if myFunction does not …

Member Avatar for pyth0n
0
106
Member Avatar for Azurea

When I try to program with wxPython using IDLE (on Vista), it also gives me this screwed up error about the wx.App() needing to be created first, all the times I run it after the first attempt. I gave up on this after a while and just switched to programming …

Member Avatar for shadwickman
0
138
Member Avatar for dem10

Ah, I didn't know that myself either. Is there more of a general definition of it? I get what the example does, but I'm just curious about the sort of extent/functions that this term can be used to/for.

Member Avatar for shadwickman
0
175
Member Avatar for hobbz86

What's the actual question you're asking? You just kinda gave a description and plopped your code out. If this is for a school project (which I assume it is), I'll try to help...

Member Avatar for jlm699
0
94
Member Avatar for pyth0n

You could always just add [icode]del let[ pos ][/icode] after that letter has been printed, thus deleting that letter from the list. It'll never be selected again.

Member Avatar for pyth0n
0
5K
Member Avatar for Adexter

Are you actually looking to assign a value to "fibnum"? Because like woooee said, it'll always return None. If you added a line like [icode]return sum[/icode] at the end of the "getfibnum()" function, then "fibnum" would be set to the same value as "sum" within the "getfibnum()" function. If you …

Member Avatar for jlm699
0
183
Member Avatar for MaxManus

I don't have scitools, so I can't test this code, but why don't you try changing the line: [code=python]line = x[i], resultat[/code] to [code=python]line = str( x[i] ), str( resultat )[/code] Tell me if that makes a difference!

Member Avatar for MaxManus
0
144
Member Avatar for leegeorg07

Wow, I've been wanting to do something like this for a while. Thanks for the link Vegaseat!

Member Avatar for shadwickman
0
104
Member Avatar for shadwickman

Hello! I've run into a slight problem with my script. As I iterate through a list of strings, I need to print each string, but they all need to print on the same line, so I used this: [code=python] for item in myList: print item, [/code] The comma puts each …

Member Avatar for shadwickman
0
141
Member Avatar for Daiosmith

I'm sorry for the stupid above post which is only advertising a different site. Anyways, why not try: [code=python] sentence = "The quick brown fox jumps over the lazy dog." search1 = "the" # start word search2 = "fox" # end word index1 = sentence.lower().find( search1 ) # search through …

Member Avatar for shadwickman
0
110
Member Avatar for Clipper34

Hi Clipper34. I'm not 100% sure what you're asking specifically, but I use wxPython. I prefer it to Tkinter - just a personal choice. You can go to [url]http://wxpython.org/[/url] to download wxPython and begin using it. As for positioning a button absolutely, just set it's position during it's creation. Example: …

Member Avatar for Stefano Mtangoo
0
103
Member Avatar for besktrap

I don't have the pygame module, but can you put a [icode]print[/icode] statement saying anything (just something to check for) into the [icode]if[/icode] statement with the line [icode]ballSpeed[1] = ((-ballSpeed[1]/4*3))[/icode] to make sure that the [icode]if[/icode] statement is actually being executed? And why is that segment encapsulated within two pairs …

Member Avatar for besktrap
0
235
Member Avatar for 2ashwinkulkarni

Why don't you just loop a function that opens each file one at a time and writes the processed information to the corresponding output file? Have an array of the .cvs files and for every one in the array, call the processing/writing function.

Member Avatar for 2ashwinkulkarni
0
2K
Member Avatar for ping24

Hmm... I just downloaded the linkchecker module and tried to figure it out for myself, but I don't even know how to use it in my own scripts. Can you give me an example of the code you're using right now? Then I might be able to help with your …

Member Avatar for ping24
0
170
Member Avatar for leegeorg07
Member Avatar for Ene Uran
0
122
Member Avatar for astrogirl77
Member Avatar for slate
0
109
Member Avatar for JA5ONS

If you're using wxPython, then I wrote a heavily commented snippet below showing it. There might be a better way, but this is all I could come up with at the moment. If any other users have a different idea, please post it too! [code=python]import wx # First screen class …

Member Avatar for shadwickman
0
109
Member Avatar for Dekudude

If you don't fully understand the [icode]re[/icode] module (I don't), you could always have it look for the first word in that two-word value (in the array), and then if it found the first one, see if the word following it in the input is the same as the second …

Member Avatar for shadwickman
0
125
Member Avatar for Scuppery

I'm gonna try looking at how to fix the first problem, but as for the second one, if you use [icode]print aa,[/icode] and [icode]print bb,[/icode] (note the comma at the end), it'll print the [i]aa[/i] on the same line as the [i]bb[/i], but will automatically add one space in between …

Member Avatar for shadwickman
0
101
Member Avatar for autumnwinter
Re: IMAP

I know your English isn't too great, and it [i]is[/i] a hard language to learn, but I can't really understand what it is you're asking. Sorry, but could you maybe clarify it?

Member Avatar for shadwickman
0
84
Member Avatar for shadwickman

Hi, just a quick question but I couldn't find an answer to it. Say I have 3 variables, "a", "b", and "c". I want to assign each one a value of None. The only way I know of doing this is: a, b, c = None, None, None Is there …

Member Avatar for shadwickman
0
122
Member Avatar for shadwickman

Hi, I couldn't get this to work, but I was using a PHP script to go through the rows in a table in my database and if it found a specific value, to delete that row. However, it deletes ALL the rows no matter what I do and throws an …

Member Avatar for nav33n
0
716
Member Avatar for shadwickman

Hi, I was wondering how to get around a problem I was having with eval(). I have a list of strings and each one is the name of a python file found in the same directory as the current script. I was it to import these modules to use in …

Member Avatar for shadwickman
0
223
Member Avatar for shadwickman

Hi, I'm using wxPython (the latest version) and was wondering how to get rid of the scrollbar on the wx.TextCtrl (multiline) object. I couldn't find anything with Google or the search on the forums. Thanks!

Member Avatar for kushyer
0
139
Member Avatar for shadwickman

Hi, I was wondering if it's possible to call a function using a string that is the exact same as the name of the function. Here's an example in which I wanted to make 4 bitmap buttons using a for loop, and the event bound to each one would be …

Member Avatar for shadwickman
0
160
Member Avatar for shadwickman

Hi, I have a string that I want converted to an integer. I tried int() but it doesn't work because of what my string (as an example) is "2*2/4". I want it to make that into an integer and just put the answer (1). Is there a simple way to …

Member Avatar for shadwickman
0
115
Member Avatar for php111

Python is quite an exceptional language, and although powerful, you can learn how to make simple applications quite easily. I got a basic education of Python just by searching Google for tutorials, and asking questions on DaniWeb. Once you understand how it works, you can then get into more complicated …

Member Avatar for vegaseat
0
182
Member Avatar for CelestialDog

I'm pretty new to Python aswell, and am still [I]very[/I] confused with the way for loops are structured (as opposed to Java or C++). I think the issue you have is with the indentation. The second to last line, 'counter1 += 1' should be within the while loop shouldn't it? …

Member Avatar for CelestialDog
0
104
Member Avatar for shadwickman

I was wondering if it is possible in Python to send a job to the user's printer. I have a string, and I wanted to be able to print it out on a piece of paper. I have wxPython installed and imported into the app if that makes any sort …

Member Avatar for shadwickman
0
185
Member Avatar for shadwickman

I was making a simple application with a GUI built with wxPython. I have created and layed out the main menu, and when the user clicks a button, it is *supposed* to make a different set of controls appear, getting rid of/hiding the main menu. I was wondering how to …

Member Avatar for shadwickman
0
113
Member Avatar for shadwickman

I just started learning Python about 2 days ago, and I threw this program together, just to get the hang of it. The program just creates a file named "PythonTest.txt" in the same directory as the .py file. The user can then enter lines that are written to the .txt …

Member Avatar for katharnakh
0
173

The End.