15,181 Topics
| |
I am trying to build a simple app that calculates the farenhit to celsius converter. Here is my code.. from gi.repository import Gtk, GObject class DemoWindow(Gtk.Window): def __init__(self): Gtk.Window.__init__(self, title="Demo Example") self.set_size_request(300, 400) vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=6) self.add(vbox) self.entry = Gtk.Entry() self.entry.set_text("Enter Farenhit") self.button1 = Gtk.Button(label="Calculate") self.button1.connect("clicked", self.on_button1_clicked) vbox.pack_start(self.entry, True, … | |
Hey guys, I'm trying to use mpi4py on my mac but I'm running into some problems. I'm just trying to get it up and running by running a simple helloworld program that runs on different processors. When I run the command 'mpiexec -n 2 python helloworld.py' I'm getting a very … | |
i have a Qt code writed in C++ . i want translate it to python code, but i have a problem in 4 code line: all code is: void TableView::print(QPainter* painter, const QRect& area) { const int rows = model()->rowCount(); const int cols = model()->columnCount(); // calculate the total width/height … | |
Hi all, I am trying to read data from an excel file using "xlrd" functions. File contains many columns one of which is Date and time (in MM/DD/YYYY and HH:MM:SS AM/PM format). I am successful in reading all other type of data. But unfortunately for this column, program could read … | |
| Is it possible to change text colour in the console window with Python? If so, could anyone tell me how? |
Hi guys, My university recently switched mail services and in order to maintain our new listservs we have to import the emails using a different format. I have all the emails in a text file like this: test@testing.com test2@testing.com test3@testing.com In order to import it to the new mailing system … | |
My first Daniweb question!! Am at the front end of learning Python (3.2.3) I'm doing a SQL query into a MySQL database for two fields, track_ID and track_duration. I'm getting a return of both, but instead of the duration value being expressed as 00:02:50, as it is stored in the … | |
Maybe you will help me in this "simple" case: request2 = urllib.request.Request(url) cj2 = http.cookiejar.CookieJar() urlOpener2 = urllib.request.build_opener(urllib.request.HTTPCookieProcessor(cj2)) url2 = urlOpener2.open(request2) allinfo2 = url2.info() Output of this script is on this image: http://img195.imageshack.us/img195/9514/20120523110058.png My question is: How I can add new element to headers ?? something like that ('Set-Cookie',"server=2") | |
Python 3.2.2 I want to check HTTP status code (eg. 200 or 404) on some www application. There are five server, and each server have a copy of this www application (The user is automatically redirected to the application on the server with low traffic/sometimes on random server). Suppose that … | |
I have a small amount of data in a file which I want to use to draw plots. I can't see any problem with the following code, but running it results in the error message below. `a,b,c = np.loadtxt('myfile.csv', delimiter=',', usecols=(0,12,18), skiprows=1, dtype=('S5, i4, S8'), unpack=True)` ValueError: too many values … | |
hey i heard that there is something called qt signals you can use it to change the GUI out side the main thread coz when i try to change it i get an error that i cant change the gui out of the main thread but i need it to … | |
I'm trying to print the contents of a QTableView to the printer . i implement bottom script and it run successfully without any error. but all data are Unusual in printPreview. this is [pic](http://img4up.com/up2/75917679167425743216.png) from my problem -[FOUNTAIN](http://www.qtcentre.org/threads/3796-QTableView-printing?highlight=Qprinter) def printTable(self,printer,painter,area): model = self.model myTableView = self.view printer = painter rows … | |
Hi guys, I'm making an RPG(role-playing game) and I need some help. Here is the code so far: class Create: def __init__(self, power, attack, defense): self.power = power self.attack = attack self.defense = defense warrior = Create(300, 50, 150) wizard = Create(500, 100, 230) characters = [ "warrior", "wizard" ] … | |
I'm working with some really ugly files at the moment When I get them they can look like any of these: All data on one line delimited by ┌ `data1|data2|data3|┌data1|data2|data3|┌data1|data2|data3|┌data1|data2|data3|┌data1|data2|data3|┌` Nice data. All the bits I'm interrested already one one line per bit of information: `data1|data2|data3|` `data1|data2|data3|` Mixed: `data1|data2|data3|┌data1|data2|data3|┌data1|data2|data3|┌` `data1|data2|data3|` … | |
Hi, i have a list that contains 5 columns that contains strings and float values(3 strings columns and 2 float columns) .. i want to export this list to a space separated text file (each column in the list is a column in the text file) i tried to do … | |
Hi everybody, I just start learning python, and beacuse of that I don't really know all usefull packages and methods, that this language has. But I would like to know how would you write this program, or how would you change it (or may be some part of it) to … | |
I'm trying to build a meta search engine in Python, probably using Grok as a framework. Django seems a little more complicated than I need. My main problem is that I can't find any decent tutorials for Grok. It's own tutorial doesn't really explain anything. The way I intend it … | |
Hello all, I have been long using Tango Icons and are good, but some stuffs are lacking. Is there good freeware Icon designer or free Icon package? Thanks alot | |
| Hello all, I am trying to think of ideas for programming projects, Python is the language I know most about so I decided to post it here. I have made some random stuff, like a Python program which generates a specified amount of asterisks I have made a text based … |
| By opaque binary i mean so that people cannot see the source code if they open the file in their text editor, so instead of seeing: print "You cant see me!" it would be something like: "0101010001010101001001010" And yes, i am trying to do this with python. |
We have requirement to write simple xml in string format from listed dictionaries iterating through list and iterating through each dictionarie and write xml format (i.e. dict key is xml key and dict value is dict value ex:- <First_name>James</First_name> ), if the value contains dictionary again we need to loop … | |
| I need some ideas for the python text based game i am making, it looks like this so far: from time import sleep import sys #Functions set at start of code def helpme1(): for a in 'Recognised commands are: explore, help, suicide, flee, look, get,open door, run and attack. With … |
How to share variable between multiprocessing and Pyside application. I am a newbie.Can anyone help me?Any suggestion will be appreciated.Thanks very much. This is my demo: #!/usr/bin/env python #coding:utf-8 #demo:pyside gui application communicate with multiprocessing.Process() import sys,time import multiprocessing as mp import logging,logging.handlers from PySide.QtCore import * from PySide.QtGui import … | |
Hi All I am working on a html parser 'selenium webdriver' and on one of the pages I found an image with text on it.The page contains other information as well. I tried to see the page source if I can extract the text on image using webdriver but I … | |
hello I am following this tutorial on how to scrap website information http://www.newthinktank.com/2010/11/pyt ... -scraping/ this is my code: EDIT: do not post off site, moved here #! /usr/bin/python from urllib import urlopen from BeautifulSoup import BeautifulSoup import re def cleanHtml(i): i = str(i) # Convert the Beautiful Soup Tag … | |
need some help on the coding can some plz help the question is: A year is a leap year if it is divisible by 4, unless the year is a Century, in which case it is only a leap year if it is divisible by 400. Write a function which … | |
I would like to copy a row in a database and change one value. I think that this is close to what I am supposed to do. [CODE] self.cursor.execute("INSERT INTO DatabaseName (C1, C2, C3, C4, C5) SELECT (?, C2, C3, C4, C5) FROM DatabaseName WHERE C1=?", [newC1Value, copiedC1Value]) [/CODE] Although, … | |
My brain is freezing up again. I have a string that looks something like this `1 apple--1 pear--1 peach--2 onion--2 carrot--3 <bee mince--3 <por chops--4 <oth salad:--potato--4 <oth bread:--garlic` Then I have a few dictionaries: dic1 = {'1': 'fruit', '2': 'vegetable', '3': 'meat', '4': 'other'} dic2 = {'bee': 'beef, 'por': … | |
import maya import sys import os from functools import partial import maya.cmds as cmds def customVer(FileName, version): #create a file path with the file you have and version you want version = 9000+int(FileName[(location-3):location]) newFileName = str((myFileName[0:(location-3)])) version = str(version-1) version = version[1:] newFileName = newFileName+str(version) return newFileName def newFile(myFileName): #find … | |
I have some text files (actually csv) that have the extension .ROS stored on a server and I can't seem to open them in Python. If I change the extension to .txt or .csv, I can open them fine either as text or csv, but I'd rather keep the .ROS … |
The End.