15,175 Topics
| |
Hello. I am a n00b learning to code in Python. Right now, I am working on functions and parameters. To practice, I am making a simple Celsius-to-Farenheit converter. However,whenever I run the program it returns a NameError. I am confused in my n00bishness. Please reply. Here is my code: [CODE]>>> … | |
here is the code: [code=python] def main(): totalBudget = 4000 printOptions() option = input("What would you like to do? ") while option != 5: if option == 1: newExpence = addExpence(totalBudget) totalBudget = totalBudget - newExpence printOptions() option = input("What would you like to do? ") elif option == 2: … | |
I currently have the budget to buy an intermediate to advanced python. The books price has to be below $50 (Canada), if possible, unless it's a really good book. Preferably there should be GUI programming in the book (not TK or QT, GTK or other toolsets preferred). Network programming (Socket) … | |
I've been googling for almost two hours now trying to find a solution, but I haven't come across anything that works yet. I followed this guide EXACTLY: [code]http://bytes.com/topic/python/insights/580045-simple-guide-using-py2exe[/code] but no results. When I run my setup.bat, a window comes up and disappears quickly. No new directories are created but I … | |
Hello i want to know how to edit the console font, width and height. If there is any script, could you post it?. And thanks. | |
Hi all, I currently working on a python program with the use of wxpython to make out a gui application. However, i wish to compile my application to be like a standalone application where people can just get the .exe file and run it without installing python and wxpython. I … | |
I want to sort a list of dictionaries using the inbuilt sort() function for lists. The problem is I am not able to understand, how to give the function a key.. Example: [CODE] a={'name':1,'data':200} b={'name':2,'data':400} c=[a,b] [/CODE] Now, I want to sort the list c with the key being a['name']. … | |
hello every one for example ıf we say a=None if is it same thıng ? ===> if a orrrr if a is None and the reaction of the code is it same thansk ın advance | |
hey guy n girls i hope one of you can help me with this. plan of action is to : create a python script to... sort a list of files from a directory into sorted list with most recent modified date at the top. then I want to get rid … | |
When runnning scapy from command prompr (windows XP), the output cannot be stored. When the following command is executed in command prompt: scapy >C:\dir.txt The following error shows up: C:\automation\atg\GeneralFiles?_AC\ScapyExe?>scapy >C:\dir.txt INFO: Can't import python gnuplot wrapper . Won't be able to plot. INFO: Can't import PyX. Won't be able … | |
I am trying to convert a testtoexe.py (which imports scapy and paramiko) file to exe. I am running Python2.6 (in PythonWin?) on Windows XP. I am using pyinstaller1.4 I am able to convert the .py to .exe, but..... I get the following error when I run the exe: C:\automation\createexe\dist>testtoexe.exe ['C:/DOCUME~1/arinc/LOCALS~1/Temp/_MEI4842', … | |
In my projet, I can't find how to determine which image and pixel coordonate when I clicking image in 2 different ScrollArea. The result was showing in statusBar() area. (See screenshot) I put a code in txt file with 2 jpg use with it. Thanks in advance. [CODE] from PyQt4.QtCore … | |
[CODE]print divmod(1024, 26) # 39[/CODE] [CODE]print chr(39 + ord('A') - 1) # g[/CODE] but: AA, AB etc, how to convert this to number? | |
i had an idea to make my own file formats but... have nearly zero coding experience. the image is just text which a program would parse and receive relevant pixel data from it(like xml based stuff). i wrote up some plan for the file: [CODE] `meta data [(title)test image] [(date)1,1,2010] … | |
Hello! I have created a dialog to select a file with wxpython and FileBrowseButton with this code. [CODE]fbb = wxfbb.FileBrowseButton(panel,labelText="Select an image file:", fileMask=mask, fileMode=wx.OPEN, size=(800,30)) markFile = fbb.GetValue()[/CODE] I need to use the selected file for further actions. How can I do it? I have tried [CODE]return markFile[/CODE] but … | |
I am looking at a project that will import and modify an XML file and then export it to a table. Currently a flat file table system should be fine. I want to export the modified data to the table and then perform a handful of maths(largely simple statistical functions) … | |
Hello friends, I have a small problem, I don't know how to configure the server to run python scripts automatically every 1 hour. I use Ubuntu LTS OS, Apache2 server and now I want every 1 hour to run read_rss.py Python script automatically. Do it possible with apache (and if … | |
Pyscripter seems to be hard coded to use versions 2.3 to 2.6, and skips over 2.7, moving on to 3.0 and 3.1 - niether which seem to play nice with Unix data. Considering 2.7 is Python.org's current stable release, does anyone know how to get Pyscripter to use it? I've … | |
In this scenario, I have two issues; 1) Why is selection 4 not taking me to exit the program variable? 2) Why is selection 2 telling me I went backward? Thank you in advance! #start and display menu def main(): #fuel fuelUsed = 0 fuel = int(200) feet = int(0) … | |
I would like to save the output of the python help() function to a file eg the output of >>> help("modules") [CODE] amongst others i used modfile = open("env:.P_ModList","w") mods = help("modules") print >>modfile , mods modfile.close() [/CODE] to no avail. Is there a solution? | |
Aproach to the implementation of K-Nearest Neighbor (KNN) using the Euclidean algorithm. Sample Usage: [CODE]mywork = Words_Works() lit = 'literature.txt' mywork.add_category(lit, 'Literature') # adding files as category comp = 'computers.txt' mywork.add_category(comp, 'Computers') phy = 'physics.txt' mywork.add_category(phy, 'Physics') # saving categories dictionary to file mywork.save_categories() # can be loaded calling load_categories() … | |
[CODE]import wx class bucky(wx.Frame): def __init__(self,parent,id): wx.Frame.__init__(self,parent,id,'Frame aka window', size=(400,300)) panel=wx.Panel(self) status=self.CreateStatusBar() menubar=wx.MenuBar() first=wx.Menu() second=wx.Menu() first.Append(wx.NewId(),"new window") first.Append(wx.NewId(),"Open...") menubar.Append(first,"File") menubar.Append(second,"edit") self.SetMenuBar(menubar) if __name__=='__main__': app=wx.PySimpleApp() Frame=bucky(parent=None, id=-1) Frame.Show() app.MainLoop() [/CODE] when i run this program, i get a "self is not defined in status=self.CreateStatusBar()". so i erased that part, and it … | |
I am trying to make a program which so i can put in orders and have shopping and handling calculated the problem is, each time i run the program there will be a different number of people placing an order, how would i set up a loop that on each … | |
""" Hi i intended to list the built-in function using this function. It seems however to give me the results corresponding with a dictionary. Why is that ? """" [CODE] def showbuiltins(): """ saves the list of built in functions to a file you chose """ blist = dir(__builtins__) print … | |
Here's a simple question. Need: => to use scipy special package function in my python prog (python2.6). 1. Downloaded & intalled numpy for python2.6 2. Downloaded & intalled scipy (scipy-0.8.0-win32-superpack-python2.6.exe) tested: import numpy import scipy - everything's ok According to scipy docs, a package needs to be loaded before a … | |
Hello, I need to store data in large lists (~e7 elements) and I often get a memory error in code that looks like: [code=python] f = open('data.txt','r') for line in f: list1.append(line.split(',')[1]) list2.append(line.split(',')[2]) # etc. [/code] I get the error when reading-in the data, but I don't really need all … | |
Hello! I am trying to creat an "About box" with wxpython. I have defined this function [CODE]def OnAboutBox(self, event): info = wx.AboutDialogInfo() info.SetIcon(wx.Icon('icons/exit.png', wx.BITMAP_TYPE_PNG)) info.SetName('Watermark Image Processing') info.SetVersion('1.0b') info.SetDescription(info) info.SetCopyright('(C) 2010 Daniel Valverde') info.SetWebSite('http://www.acrocephalus.net') licenseFile = open('license.txt') info.SetLicence(license) info.AddDeveloper('Daniel Valverde') info.AddDocWriter('Daniel Valverde') info.AddArtist('Daniel Valverde') info.AddTranslator('Daniel Valverde') wx.AboutBox(info)[/CODE] I know that … | |
Well, since there was no option for "tutorial" in the type of post, it has been created as a simple thread... Obfuscation - confusion resulting from failure to understand obfuscated code - Code that is hard to read In this tutorial, I will show you how to convert something readable, … | |
Okay, so in all honesty, I began learning Python about 2 days ago, so this is a rather noobish question(well, I've programmed in other languages, so it's not THAT noobish), but I'm making an IRC bot and can't figure out how to make it so that a line of code … | |
In the following program can someone help me figure out why the close button [X] at the top right corner isn't working? [CODE] # imports from Tkinter import * from sound_panel import * import pygame.mixer # create gui app = Tk() app.title("Head First Mix") # create mixder mixer = pygame.mixer … |
The End.