15,406 Topics

Member Avatar for
Member Avatar for clouds_n_things

Ok so, question about opening an application from python..is there a command that will force an app to open, while at the same time leaving the tkinter GUI open? The app I am trying to open is Snes9x. import os from tkinter import * try: import Tkinter as tk from …

Member Avatar for clouds_n_things
0
234
Member Avatar for mkweska

Hello all! Hope to be a very active nad productive member here as I learn. Currently in a python class and have a problem to solve. Not quite sure where my mistake is.... I am to put the inputs in the main function pass to the processing function and call …

Member Avatar for mkweska
0
226
Member Avatar for vegaseat

Another exercise in applied geometry. This time we use the Tkinter GUI canvas and its create_line() function to draw a triangle, or a series of connected triangles to create something that looks like fancy art work. You might be able to impress grandmama with that one!

Member Avatar for vegaseat
1
3K
Member Avatar for krystosan

with python interpreter `E:\Dropbox\Research_Study\myprojects\Batch>python Render.py ` Traceback (most recent call last): File "Render.py", line 801, in <module> else: run() File "Render.py", line 789, in run win = Window() File "Render.py", line 66, in __init__ self.createUI() File "Render.py", line 314, in createUI self.sfEdt.setValidator(QtGui.QIntValidator()) TypeError: arguments did not match any overloaded call: …

Member Avatar for vegaseat
1
167
Member Avatar for tunisia

I'm trying to expedite the process of manually opening up an XML file and searching for some info in it. I want to store some of the data, etc. Nothing elaborate. But I'm not clear on some of the file structure. For the seasoned XML data wrangler, can you instantly …

Member Avatar for tunisia
0
460
Member Avatar for mmpal78

Hi, I have python 2.7 & python 3 installed on ubuntu. I just installed pygame and have it working so far in python 3 which is what I want to be doing. However I can only load bmp images in python 3. When I try to load a jpg I …

Member Avatar for slate
0
533
Member Avatar for inuasha

alright so my exact problem is that when I attempt to visit a url stored in a text file I get the error "URLError: <urlopen error no host given>" This is strange because if I type in the urls myself they work fine(opener.open("site.com")) The lines of code causing the error …

Member Avatar for snippsat
0
278
Member Avatar for aVar++

I have my battleships game working completely accept ships do not generate randomly. I have each point of the ship assigned to certain squares. Example: ship_1_1 = Grid[1][1] ship_1_2 = Grid[1][2] ship_1_3 = Grid[1][3] ship_1_4 = Grid[1][3] Randomly generating ships is harder than I thought. For these reasons: - Ships …

Member Avatar for woooee
0
464
Member Avatar for vegaseat

A function to take a text and extract the string between two given substrings. Allows you to find the nth occurence. Also safeguards against dead ends.

2
1K
Member Avatar for JordanSimps

I kind of have an idea what to do, but I can't figure it out. The program needs to be able to get the students name and three test scores, then get the average score (percentage) out of the three scores. After that, you need to convert the score (percentage) …

Member Avatar for vegaseat
0
259
Member Avatar for rev_ollie

Hi again, I've been looking more at reading serial - this time with a GUI in front. After attempts to get it working I thought it best to try threading to perform the task. What it should do is read the serial port and update a label with the frame …

0
373
Member Avatar for bumsfeld
Member Avatar for Umar Suleman
3
410
Member Avatar for aashishkulkarni

I am going to create graphics interface to intermediate code generated by the gcc. so the output from gcc is like ;; Function main (main, funcdef_no=1, decl_uid=2162, cgraph_uid=1) main () { int i; int c[10]; int b; int a; int D.2177; <bb 2>: a = 1; b = 20; if …

0
153
Member Avatar for ZeeeeeV

I have been working on a Python coded priority email inbox, with the ultimate aim of using a machine learning algorithm to label (or classify) a selection of emails as either important or un-important. I will begin with some background information and then move into my question. I have so …

0
169
Member Avatar for m_ishwar

Hey this bit of code is giving a lot of trouble. I am new to python and have no idea why I am getting an error like this : Traceback (most recent call last): File "D:/Python27/saved/digital_filter.py", line 83, in <module> app=Application(root) File "D:/Python27/saved/digital_filter.py", line 23, in __init__ self.create_widgets() File "D:/Python27/saved/digital_filter.py", …

Member Avatar for m_ishwar
0
196
Member Avatar for TBSouth

Hi. I'm currently working on my bachelor's thesis in which i'm hoping to assess whether a (simplified) programming exam generates a "better" result if taken in an adjusted computerized environment compared to taking it with only the use of pencil and paper. I have built a web based platform, with …

Member Avatar for TBSouth
0
166
Member Avatar for padton

I have over 10 text files, each file has exactly 2671 floats e.g. 1.232124234 #line 1 2.324234323 #line 2 . . 1.324234234 # line 2671 I would like to the add together the floats on each line with the float on the corresponding line for each of the 10 files, …

Member Avatar for snippsat
0
225
Member Avatar for aVar++

Hi guys, I got this from my teacher and im really confused. could anyone point me in the right direction? Thanks > What does it do? > > This time I'm looking for an overall summary, in one sentence, with the word "by" in the middle: > "This function ..........., …

Member Avatar for Lucaci Andrew
0
234
Member Avatar for nivert

so i'm making a project for a buddy that's going to (eventually) ask a word, then it's definition, and I need 50 entry boxes on the screen, but there must be a simpler way to grid all of them (I'd like to use a sort of for loop instead of …

Member Avatar for Lardmeister
0
10K
Member Avatar for TrustyTony

Notice that if you negate a boolean value with `not` in comparison with other boolean value or similar, you should put it inside a pair of parenthesis, otherwise you get syntax error: >>> 0 == not 1 SyntaxError: invalid syntax >>> 0 == (not 1) True >>>

Member Avatar for ZZucker
2
188
Member Avatar for BigPaw

In [this thread](http://www.daniweb.com/community-center/geeks-lounge/threads/436142/which-language-is-best-suited) in the Geeks Lounge it was wisely recommended that I download an add-on for Python called Numpy. However, Numpy isn't presently available for Python 3.3. What should I do, please? How important is Numpy? Also, what would be the implications for not having wxpython available to Python …

Member Avatar for Lardmeister
0
701
Member Avatar for Rod53718

How do you get an imported function to find a function in the main program? This runs fine if I put the generate_random function in with the main, but if it is in an imported function it can't find the printa function in the main. It comes up with the …

Member Avatar for Rod53718
0
270
Member Avatar for nivedita.datta

Hi, I am unable to run the code given in the following link https://github.com/hamilton/LocalitySensitiveHashing properly. Can anyone help me on the instructions, as in where and how to provide the data. I am facing problem in the following step : this_lsh.bin_data(data) as given in the README. I am unable to …

Member Avatar for vegaseat
0
296
Member Avatar for slasel

I tried to create those 6 radiobuttons(bh1,bh2,bh3,bh4,bh5,bh6) using a for and placing them in a dictionary but I get the following error whenever they should be displayed! I have attached a folder with the images. Any help please is highly appreciated! Thank you Exception in Tkinter callback Traceback (most recent …

Member Avatar for vegaseat
-1
347
Member Avatar for petzoldt01

Just polling for users who are familiar with Django. Deployment? Development? Maintenance? Doesn't matter! Just trying to get a head count, maybe spawn some topics, make some friends, or whatever. Django is a pretty fantasitic project. It is extensive and documented extremely well (almost too well; reminds me of the …

Member Avatar for vegaseat
0
195
Member Avatar for ITech

inventory = {'gold' : 500, 'pouch' : ['flint', 'twine', 'gemstone'], 'backpack' : ['xylophone','dagger', 'bedroll','bread loaf']} how do i delete the item 'dagger' only from the 'backpack'

Member Avatar for Lucaci Andrew
0
74
Member Avatar for mccrimmonmd

My company recently hosted a programming competition for schools across the country. One team made it to the finals using the Python client, one of the four default clients provided (I wrote it). Most of the other teams were using Java or C#. Guess which team won? http://www.windward.net/codewar/2013_01/finals.html * *This …

Member Avatar for Lardmeister
1
130
Member Avatar for RockJake28

I have this code so far #Add two digits def add(a,b): return a+b #Subtract two digits def sub(a,b): return a-b #Multiply two digits def mul(a,b): return a*b #Divide two digits def div(a,b): return a/b #returns an integer that the user enters def getCommand(): cmd = input("Choose: ") return cmd #Execute …

Member Avatar for Lardmeister
1
224
Member Avatar for pxalpine

I have 2 text files: *cities.txt* San Francisco Los Angeles Seattle Dallas *master.txt* Atlanta is chill and laid-back. I love **Los Angeles**. Coming to **Dallas** was the right choice. New York is so busy! **San Francisco** is fun. Moving to Boston soon! Go to **Seattle** in the summer. *output.txt* <main><beg>I …

Member Avatar for pxalpine
0
146
Member Avatar for sudipta.mml

Hi ALL, I want to analyze my data by a python script. The data are in multiple file and they are kept in different directories. Moreover, the name of the files in those directories are same but have different extension. I want to get my output just by providing a …

Member Avatar for otengkwaku
0
232
Member Avatar for Octet

Hello Daniweb, I'm learning Python at the moment, and I'm starting by looking at automating some of my server tasks, namely things like backups, virus scans and checking for IP changes (being on a dynamic IP, automating this task will be very helpful). I've started by creating some code which …

Member Avatar for Octet
0
180
Member Avatar for Fernando_1

# Purpose: Tax input amount # #----------------------------------------------------------------------- # VARIABLE DEFINITIONS salesAmount= 0.0 salesTax=0.0 total=0.0 #----------------------------------------------------------------------- # CONSTANT DEFINITIONS #----------------------------------------------------------------------- # FUNCTION DEFINITIONS #----------------------------------------------------------------------- # PROGRAM'S MAIN LOGIC salesAmount = float (raw_input("Enter the sales amount:")) salesTax = float(salesAmount*0.08) total = salesAmount + salesTax print "The sales amount is $", salesAmount print …

Member Avatar for vegaseat
0
219
Member Avatar for vegaseat

You may want to call Python's list the answer to other computer languages' arrays. Here we take a look at the things you can do with lists, create an empty list, list the attributes and methods, load, append, count, insert, join, pop, remove, remove duplicate items, reverse, search, sort, establish …

Member Avatar for vegaseat
3
416
Member Avatar for biscayne

I have a table with product codes, the first two chars of the product code is the product group. using the product group I'd like to test the content of certain data. Would this be proper coding or is there a better way ? if prodcust_code[:2] == "AB" do: ABsubroutine …

Member Avatar for vegaseat
0
240
Member Avatar for clouds_n_things

Really quick question, if I want to return the data that is returned by snesVar in videoGame as a string on every line, what is the correct code to use? def videoGame(): count = 0 snesVar = [] for data in os.listdir('/SNES/SNES Roms'): if data.endswith('.src') or data.endswith('.srm'): snesVar.append(data) return snesVar …

Member Avatar for clouds_n_things
0
131
Member Avatar for padton

Hi all, I am trying to rewrite the following code, to avoid having to write 60 individual loops,I would really appreciate your help with this. # Long Version - not ideal num = 60 n = [open('n%i.txt' % i, "w") for i in range (num)] for a2s1, a2s0, a1s1, a1s0 …

Member Avatar for TrustyTony
0
178
Member Avatar for TrustyTony

![circuit](/attachments/small/2/circuit.jpg "align-right") Here is a version in Python of program from classic Lisp book (see http://www.daniweb.com/software-development/legacy-languages/code/446235/simple-scheme-functions-for-finding-impedance-for-norvigs-implementation for the details) for calculating impedance of a circuit. (Example circuit with 1MOhm like in the book's code not like in diagram)

0
2K
Member Avatar for TrustyTony

![Lisp001](/attachments/small/2/Lisp001.jpg "align-left") ![Lisp002](/attachments/small/2/Lisp002.jpg "align-right") I did translation to minimal Scheme implementation of Norvig written in Python (http://www.daniweb.com/software-development/python/threads/359370/norvig-an-even-better-lisp-interpreter-in-python) of the impedance code defined in classic book **Lisp by *Patric Henry Winston* and *Berthold Klaus Paul Horn*** from year 1981 (first computer book I ever bought). Errata: diagram has 10 MOhm when …

0
630
Member Avatar for carbonicacid81

I need to write a program that implements Newton's method ((guess + x/guess) / (2)). The program should prompt the user for the value to find the squareroot of (x) and the number of times to improve the guess. Starting with a guess value of x/2, your program should loop …

Member Avatar for vegaseat
0
5K
Member Avatar for Andyvonschweal

I am working on an assignment in college using RUR-PLE as a starting program. I don't know if you know what that is or not, but I was wondering how to use it? I enter in this code: x = input("How many beepers are in this maze?") def place_all(): repeat(put_beeper,totalBeepers) …

Member Avatar for Lucaci Andrew
0
253
Member Avatar for vegaseat

This PySide (PyQT) code sample shows you how to apply a StyleSheet to a GroupBox containing a number of RadioButtons.

3
3K
Member Avatar for vegaseat

A little fun drawing with the Python module turtle. Well commented to help the beginner.

3
289
Member Avatar for ricepicker417

I mainly need help with creating the 3 by 4 matrix (part 3 of the assignment) as i am confused as how i would create it. However this is the entire assignment: 1. Write a function that returns the sum of all the elements in a specified column in a …

Member Avatar for vegaseat
0
2K
Member Avatar for flebber

I am reading the book for web2py. It is running through some python syntax examples. When I ge to this closure example I am not understanding how 'y' gets its value. This is the code. >>> def f(x): def g(y): return x * y return g >>> doubler = f(2) …

Member Avatar for flebber
0
149
Member Avatar for krystosan

Hello, I have got [this](http://www.yasinuludag.com/darkorange.stylesheet) a Qt stylesheet, how do I load it to my PyQt module after creating a QString Object. if I do from PyQt4 import QtCore s = QtCore.QString('c:\myProject\darkFantasy.stylesheet') the above code loads the path string rather than the actual stylesheet. So how do I load the …

0
153
Member Avatar for Rod53718

#McListBox Example #Jan.20, 2013 import tkinter as tk import tkinter.font as tkFont import tkinter.ttk as ttk #import re Actors_list = [("Rowan","Atkinson"),("John","Candy"),("Morgan","Freeman"),("James","Garner"),("Cary","Grant"),("Kate","Hudson"), ("Jack","Nicholson"),("William","Powell"),("Arnold","Schwarzenegger"),("Tom","Selleck"),("John","Wayne")] Movies_list = [[("Bean","1997"),("Mr. Bean's Holiday","2007"),("The Lion King","1994"),("Johnny English","2003"),("Johnny English Reborn","2011"),("Keeping Mum","2005"),("The Black Adder","1982-1983")], [("Dr. Zonk and the Zunkins","1974"),("Tunnel Vision","1976"),("SCTV","1976-1979"),("1941","1979")], [("The Pawnbroker","1964"),("Blade","1973"),("The Electric Company","1971-1977"),("Attica","1980"), ("Brubaker","1980"),("Street Smart","1980"),("Driving Miss Daisy","1989"),("Glory","1989"),("Unforgiven","1992"), ("Outbreak","1995"),("Se7en","1995"),("Amistad","1997"),("The …

Member Avatar for Rod53718
0
5K
Member Avatar for lucaspenney08

Im new to python and im runnung xubuntu! I was wondering if there is a site that does tutorials for Python in xubuntu??

Member Avatar for lucaspenney08
0
71
Member Avatar for giancan

Hi everybody, is there anyone with experience with opencv for python? I was wondering if there is a way to allocate some memory on demand, since when I try processing images (usually bigger than 800x800 pixels) I get a "OpenCV Error: Insufficient memory (unable to allocate 59500564 bytes)" message. (bytes …

0
117
Member Avatar for dashing.adamhughes

Hi guys, I have a code that intercepts calls to methods via __getattr__. Something like: def __getattr__(self, attr, *fcnargs, **fcnkwargs): out=getattr(self._df, attr)(*fcnargs, **fcnkwargs) etc... My goal is when a user calls a method, if it is not a method of self, the program attempts to run it on one of …

Member Avatar for dashing.adamhughes
0
182
Member Avatar for Rod53718

I'm fairly new to python. I've been using a modified verson of McListBox from a posting by vegaseat to get 2 treeviews going. It's been working well until I've been trying to be able to click on one to select what will be shown in the second. Anybody have an …

Member Avatar for Rod53718
0
3K

The End.