15,175 Topics
| |
i am new to PyGtk. i don't know how to get realtime update on gtk. such as downloadmanagers show's every time the speed changes. here is my. in this code the "f='/home/tree.txt'" is a log file .this file regularly updated by another thread. i want to add the file contents … | |
I've just started learning Python but have hit a little issue when instancing a class. I seem to get errors like: AttributeError: type object 'Stuff' has no attribute 'a' or: AttributeError: class 'Stuff' has no attribute 'a' Clearly I'm missing something fairly fundamental :/ A quick test program shows what … | |
| Hey All, I have made a program called "Pymailer", I have even made a GUI version... now what I want to do is to convert it to .exe format... how do I do it? I googled for some info, but in vain! |
Hello guys I want to convert an integer to a hexadecimal string examples lets say i have an integer value 1 i want to convert it to 0001 integer value of 16 => 0010 245 =>00F5 and so on the string must have a length of 4 digits my code … | |
I'd like to make a bogus Windows window pop up asking the user to choose between energy settings (better performance vs. better energy savings). This is for a social psychological experiment about ecologically sustainable behavior, so it's completely legitimate; it's approved by an ethical board, and the participants will be … | |
Okay, I wrote a simple calculator, not in GUI form, but a calculator for simple stuff. So I'm wondering, would this layout be considered OO? I think this is how it works. Now I do know that I didn't use an object to handle the class since it just wasn't … | |
Hi Friends, I need to write a piece of code to identify if an Excel session(the process which is listed in the Task Manager) is already running or not?. Can anyone guide me with this? Any help will be much appreciated! Regards, Dinil | |
[CODE]#include <iostream> #include <string> #include "Python.h" using namespace std; #define py PyRun_SimpleString(pythonCommand.c_str()) int main() { string pythonCommand; //Python started Py_Initialize(); pythonCommand = "import sys";py; pythonCommand = "from math import sqrt";py; pythonCommand = "sys.setrecursionlimit(1000000)";py; //factorial function pythonCommand = "def ft(x): return(1 if x==0 else x * ft(x-1))";py; //equation using function pythonCommand … | |
I have a Syncing program that, while idle, crawls through the sub-directories of the sources and destinations saved to a 'sync profile'. It starts a new thread and walks the directories calculating the divergence between the sources and directories. I want this feature to have little impact on computer performance … | |
I have to make some bookmarks so I quickly knocked up the script below and ran it. It created the files fine but with a with an incorrect ip in the second file The second bookmark created should be named York.URL which it is but the ip address of the … | |
First Question: Use the following variables: i , lo , hi , and result . Assume that lo and hi each are associated with an int and that result refers to 0 . Write a while loop that adds the integers from lo up through hi (inclusive), and associates the … | |
The following code should return the longest odd-length palindrome in a string centered at the index. So in a string 'asradarer' it should return 'radar'. Can you explain to me what the problem here is? [CODE]def get_odd_palindrome_at(word, index): num = 1 new_word = "" while index < len(word): if word[index … | |
My file directory is full of filenames with "male" and "female" being part of them. I want to loop through the directory and distinguish between the two. [CODE] import os maleDataSets = 0 femaleDataSets = 0 females = [] males = [] filePath = "Dataset/parameter feature vectors" for file in … | |
I the following program, can someone please explain these two lines. "def __init__(self, master):, & Frame.__init__(self, master)" One other thing. Shouldn't the method "update_count" use a return to return the new count? thanks. [CODE]# Click Counter # Demonstrates binding an event with an event handler from Tkinter import * class … | |
Heres the situation so far.I'm in 9th grade and I've been programming in python. I enjoy python however, my high school doesn't offer any courses for python. In 11th and 12th grade, I can take C++. So here's my question: Should I: A) Learn python for the next to years … | |
Hi Everyone, Sorry if this has a totally obvious solution. I am trying to write a simple cows and bulls game; the program generates a secret number, the player has to guess it, the program then compares the guess to the secret number and tells the player that either they … | |
I have program than finds the minimum temperature of every month, but i can't find a way for it to find the minimum temperature that is higher than 0, i can't just use min() cos if the month has temperature that is lower than 0 it is also counted. | |
So I'm interested in learning about data validation. Especially in Python. Python all ready has several common idioms for data validation. There are several statements that evaluate data. For instance, isinstance(object, classinfo) will check that the given object is an instance of the class or type in classinfo. One idiom … | |
Hello everyone, new programmer here. In my class we have an oppurtunity to make up credit on a previous homework by modifying a program if we got any of it wrong. The problem for the progam was: Problem #4. Write a program to solve the following problem. Find a word … | |
| I am trying to specify which variables a function should return. The purpose of this is to allow the function to return different sets of variables according to the requirements of another function, in order to make things more efficient (rather than always returning all the variables): [CODE] # Python … |
I want to call another object's methods from another object, and I have no idea how. Can someone please help me? Thank you. | |
Hi, I'm looking for a little help with the function "getattr". Here's my code: [code=python]class MyClass: def __init__(self): trycmd = getattr(self, "cmd_testing") try: trycmd() except: print "Fail." def cmd_testing(self): print "Victory!" obj = MyClass()[/code] So, when I run this code, I get the output "Fail.". I'm not sure what I'm … | |
I am new to Python and am trying to marry a Python module with a CGI interface. I understand a little of both but not how they work together. I created a class called Vehicle and (using IDLE) and am able to import it and set the year, make, and … | |
Alright, this is how my newest program looks like: [CODE]import math def main(): print('This program finds the real solutions to a quadratic') print s = float(input('Please enter the coefficients (a,b,c): ')) a, b, c = s.split(',') discRoot = float(math.sqrt(b * b - 4 * a * c)) root1 = (-b … | |
I finally got apache installed. I moved my .cgi python web application to var/www/cgi-bin however when I went to 127.0.0.1/cgi-bin/web.cgi but it said the web address didn't exsist. So I put the file in in var/www/ and it just read what was in the script, it didnt execute it. So … | |
This is my python script: [url]http://gsingh.pastebin.com/mc602006[/url] This is my setup.py file for py2exe: [url]http://gsingh.pastebin.com/m70a19449[/url] When I go to command prompt and run the .py file with the command, email.py message It works fine, it sends me an email with the message, which is what it's supposed to do. When I … | |
hi, im trying to make a program that simulates the game Risk. It should output something like this: [code] Attacking Army: Army A Defending Army: Army B Number of attacking army: 4 Number of defending army: 3 ----------------------------------- Round 1: Army A: 3, Army B: 2 Attackers' Dice: 5 2 … | |
I read the guidelines on posting homework questions and I think this one is within the rules. A little background, currently taking my first computer program class, its an online class (big mistake), it's very hard to get feedback or assistance. I have been ripping my hair out trying to … | |
In my file, I have lines similar to this <Log LogID="633198520" LogLevel="Normal" Date="10/01/09 19:18" Type="Error" Source="Mentor" Text="Failed to process the request." /> When the line is read, if it is converted as field value pair I thought it will be easy to take required field. Please advise how this can … | |
I need to gather data from a weather rss feed. But i ONly need certain "Variables, such as humidity, temp (high and low) etc. What I want to do is (i think) is parse them from Rss to integers in python. Any help would be much appreciated. :) |
The End.