15,190 Topics

Member Avatar for
Member Avatar for snake03

Hi I am new to python and am learning how to use tkinter. I am creating a game and need to create callbacks for the buttons so the game has a cell location when a player clicks on the corresponding button. I am unsure on how to do this, hope …

Member Avatar for vegaseat
0
96
Member Avatar for gunbuster363

Hi, I am new to here. I am doing with my honours project in University, it is about data mining. Before I can do data mining, first I need data. I want to extract data from a site : [url]www.tripadvisor.com[/url] Should I write my web crawler with python? I don't …

Member Avatar for gunbuster363
0
440
Member Avatar for Godflesh

How can you check the length of a file / list and then use the value in an "if-loop" in python? I want to create a "if-sats" that must check the amount of elements(numbers) in a textfile, if the amount is less then 5 do this... else do that..

Member Avatar for Godflesh
0
97
Member Avatar for danibootstrap

Hi, The following is a GPS string: $GPGGA,092204.999,4250.5589,S,14718.5084,E,1,12,24.4,89.6,M,,,0000*1F $GPGSA,093345.679,4234.7899,N,11344.2567,W,3,02,24.5,1000.23,M,,,0000*1F $GPGSV,044584.936,1276.5539,N,88734.1543,E,2,04,33.5,600.323,M,,,*00 $GPRMC,199304.973,3248.7780,N,11355.7832,W,1,06,02.2,25722.5,M,,,*00 $GPVTG,066487.954,4572.0089,S,45572.3345,W,3,09,15.0,35000.00,M,,,*1F I want to extract the line following and including $GPGGAand $GPRMC.The GPS string length is variable.Please let me know how to do this and store each of them into a single string or 2 separate strings. thanks in …

Member Avatar for slate
0
117
Member Avatar for fuston05

making for practice a temp converter. i got the basic program to convert C to F. heres that part: C = input("what temperature (celius) do you need converted? ") print "%s degrees celsius is equal to %s degrees Farenheit" % (C, 32+(212-32) / 100.0 * C now im trying to …

Member Avatar for fuston05
0
167
Member Avatar for punter999

import wx class McaMenu(wx.Frame): def __init__(self, parent, id, title): wx.Frame.__init__(self, parent, id, title, size=(640, 432)) menubar = wx.MenuBar() file = wx.Menu() new = wx.MenuItem(file, 1, '&New\tCtrl+N', 'Creates a new document') file.AppendItem(new) file.AppendSeparator() open = wx.MenuItem(file, 2, '&Open\tCtrl+O', 'Open New document') file.AppendItem(open) save = wx.MenuItem(file, 3, '&Save\tCtrl+S', 'Save') file.AppendItem(save) save = …

Member Avatar for Namibnat
0
107
Member Avatar for Godflesh

Hello! I have some probs with this code, somehow it dont loop 10 times as it should, just one? How do i make python use a testfil.txt that already exist? I dont want to remove the old data in the file just add new data to it? In this code, …

Member Avatar for Godflesh
0
85
Member Avatar for Cornholio

Hi, I have jest started learning Python. I would like to get some help on writing a script that would delete a set number of lines from a text file which looks like this : 1846440556 1846440521 1846440491 1846440505 1846441137 1846441102 1846441080 1846441331 1846441323 1846441315 ... ... Thanks in advance …

Member Avatar for Godflesh
0
26K
Member Avatar for lrh9

And I can't get anything I write to work. I'm so far off course I think I just need a working example of import hooks in action. I've looked for examples on the Internet, but they only show what looks like correct code. They never show that code in action. …

Member Avatar for lrh9
0
347
Member Avatar for digitaldust

Hi everybody, I would like to implement a task but I'm not sure the best way to do it. I have some objects each of which has an attribute that represent the object coordinates as a tuple. I would like to find the neighbors of each object, that is the …

Member Avatar for woooee
0
144
Member Avatar for greatkraw

why do I only end up with one object in the list i want to keep appending I am sure the answer is simple, thanks studRoll = [] def GetInteger(i): try: return int(i) except: return 0 class stud: def __init__(self, a, n, m): self.age = a self.name = n self.mark …

Member Avatar for woooee
0
108
Member Avatar for kbalamuk

How do I access windows environment variables using Python? eg. if I have the following: set junk=C:\temp\junk how do I access 'junk' from python?

Member Avatar for AutoPython
0
94
Member Avatar for voolvif

Hi, I'm trying to parse an apache log file and match the IP addresses in it. This is my code so far: [CODE] import re ippattern = re.compile(r"\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b") def matchmyip(): if ippattern.search(line): matchedip = ippattern.search(line) print matchedip.group() [/CODE] Now given a line like this from a log file: [CODE]1999-08-01 00:00:00 …

Member Avatar for voolvif
0
3K
Member Avatar for lrh9

(A quine is a program that produces its own source as its output, typically to a file.) [CODE=Python]import sys ifile = sys.argv[0] counter = 0 istream = open(ifile) source = istream.readlines() source[2] = 'counter = ' + str(counter + 1) + '\n' if counter == 0: original = str(ifile) source.insert(5, …

Member Avatar for dwks
0
160
Member Avatar for i_saw_some

Hi, I used SCons to create a shared library (dll) from a c++ file (hello.cpp) below. Then I used Python and it ctypes library to load in the dll and call its functions. I can load the dll and call the main function, but nothing else. I cannot call the …

Member Avatar for annu7uch
0
2K
Member Avatar for hopefullin

Hello, I need some help with python GUI. There are one image(image1), two plots(plot1, plot2) in the GUI. I want they share the same axes. I tried with many methods but only found that just one axis is shared. Another problem is the image and plot redraw flicker. How to …

Member Avatar for hopefullin
0
414
Member Avatar for explorepython

Hello all, I want to display a hyperlink in qt. For this i need to display the link for the url (as underlined text). I can achieve it easily using style sheets and the url can be opened with webbrowser module.. I want to get the clicked signal of the …

Member Avatar for explorepython
0
747
Member Avatar for zrin

Hi! I am working on another program, this time it's a guessing game. I have spend so many hours late in the night, but i can't figure out how to fix this problem. I won't the program to read the input number and display if it is bigger, smaller or …

Member Avatar for zrin
0
109
Member Avatar for bryancan

I have to try and echo something to a file from python, but because fot eh content of what I want to write to this file, I seem to not be getting all of what I want into the file. Here is what I WANT to echo to a file: …

Member Avatar for woooee
0
105
Member Avatar for Dokino

hello, when I was writing length converter I came across this problem while statement(bold one) gives me Indentation Error that says "unindent does not match any outer indentation level" and I was wondering why's that? Could anyone suggest me how to fix it [code=python]def leng(): def milimetrai(): while True: try: …

Member Avatar for Dokino
0
126
Member Avatar for Skeltpl

Hi I'm new to Python and the book I'm using was designed for an older version of Python and consequently there are some examples in the textbook that don't work in 3.1. My first problem is with the following simple example: num1, num2 = input(" Please enter two numbers (num1, …

Member Avatar for Skeltpl
0
129
Member Avatar for eva yang

Hi there, Can anybody tell me what is[B] internal documentation[/B] and what is[B] external documentation[/B] based on the following example: def is_palindrome(s): '''If the str is a palindrome which is a phrase that reads the same \ forwards and backwards return True; otherwise, return False.Assume that\ there are only lowercase …

Member Avatar for vegaseat
0
96
Member Avatar for deonis

Hello ! Recently I was doing some text formatting using python and this forum was extremely handy. My problem now is to put any letter in subscript or superscript. Apparently in Unicode there are just a few symbols in superscript but I want to put let say letter "b" in …

Member Avatar for deonis
0
13K
Member Avatar for DimaYasny

Hi guys, We're writing a GUI based on PyQt, and we're running into an issue when using different resolutions. Problem is, we can't find how to get the GUI elements to automatically resize when the window is resized, or when the GUI is running on a larger resolution than the …

Member Avatar for DimaYasny
0
3K
Member Avatar for Namibnat

Is there a way to incorporate a spell checker within a wxPython gui? I would like to be able to check the spelling of wx.TextCtrl values before they get posted to a sqlite3 database. I would imagine that the spell checker would be very os specific, but for me it …

Member Avatar for Namibnat
0
364
Member Avatar for ivh90

hello all first let me say I am really glad to become a part of this community. I am college student majoring in computer systems engineering(more hardware than software), but i am really interested in interfacing computers with microcontroller based projects. I took programming courses in java , and now …

Member Avatar for vegaseat
0
162
Member Avatar for Namibnat

Hi there, I would like to be able to change a button during the runtime of a gui. I can change the value no problem (set Label) but I need to change the size of the button as well. I have managed to change it with SetSize((120, 30)) but then …

Member Avatar for Namibnat
0
277
Member Avatar for BlackPhoenix

Hi everyone, I am in the process of learning how to use select to run a server that can handle multiple clients. I have not been able to find any server examples which implement Try/Catch Exception errors, which I believe is the root of my problems. Basically the server works …

Member Avatar for BlackPhoenix
0
1K
Member Avatar for Krstevski

Hello... I want to display rss feed from another site in html, but I don't know how can I get the images of the rss items... In the rss have only "Title", "Link" and "Description"... So, can someone tell me how to get the images from rss items ? P.S. …

0
57
Member Avatar for mahimahi42

I've been coding a simple dice roll game to practice Python. I've got the basic mechanics worked out, but I want to have it so that the player receives 5 points every time the game is won. I've tried just simply adding 5 to the variable (PLAYER_TOTAL in the case), …

Member Avatar for jcao219
0
145

The End.