15,185 Topics

Member Avatar for
Member Avatar for wandie

I have a program that displays its results in this manner. I added the results in an array this is what I got. [code] [20] [35] [40] [84] [100] [245] [260] [300] [440] [521] [650] [/code] How can I put it in this way ['20','35','40'] i used append but it …

Member Avatar for ghostdog74
0
158
Member Avatar for MarkWalker84

Hi everyone! Im stuck... I'm currently writing a GUI program to control a piece of machinery. I am using wxPython along with a few other bits and bobs including USPP for serial access. My problem is that i need some way of 'pinging' the machine. ie I want to be …

Member Avatar for bumsfeld
0
80
Member Avatar for mattyd

Is there an option of some sort in the Dr. Python interpreter that would allow one to re-run the same output results after making adjustments to the code. Example: I run an example of source code and receive an output result. I make changes to the code. I now am …

Member Avatar for vegaseat
0
132
Member Avatar for sneekula

The department's computer has Python 2.4 and on my home computer (really my dad's computer) I installed Python 2.5. Is it possible to have Python 2.4 and Python 2.5 on the same computer?

Member Avatar for vegaseat
0
110
Member Avatar for sneekula

Since there is so much discussion on one of the threads on zipping/unzipping files and all the associated incompatibilities, is there a way to do this with Python and cut out the middleman?

Member Avatar for vegaseat
0
132
Member Avatar for jrcagle

This is part of a short script I wrote to find out whether students had submitted any corrections to work in December or January. [code=Python] import os, os.path months = ['Dec', 'Jan'] # actually a raw_input() files = get_all_files(root_dir) # actually a call to os.path.walk() dates = [] for i …

Member Avatar for jrcagle
0
137
Member Avatar for Matt Tacular

I know wxpython is supposed to be better than tkinter, but I can't find any easy to understand tutorials on how to begin using wxpython. But anyway. How can I get tkinter to load up a jpg?

Member Avatar for jrcagle
0
162
Member Avatar for danielfolsom

I'd like to set up something like this: a=0 class b: def__init__(self, foo): self.foo = foo def create(): global a a=a+1 a=b("FOO") Where the number 1 will define the instance (I'm not sure if define is the write word, whatever you put before the equals sign when your creating an …

Member Avatar for jrcagle
0
108
Member Avatar for sharma_vivek82

code: you can change this code as you like [code] import wx import os from wxPython.wx import * import wx.html class MyHtmlFrame(wx.Frame): def __init__(self, parent, title): wx.Frame.__init__(self, parent, -1, title) html = wx.html.HtmlWindow(self) html.SetPage( "This is test implementation of Simple <b>Notepad</b> using <font color=\"red\">wxPython</font> !!!! " "<br>View is created using …

Member Avatar for pty
0
410
Member Avatar for sharma_vivek82

[code]#Auther : vivek sharma #date : 06-11-2006 #Description : This script is used to get the list of week in given year, user have to input the year , def WeekFinderFromYear(year): """ will return all the week from selected year """ import datetime WEEK = {'MONDAY':0,'TUESDAY':1,'WEDNESDAY':2,'THURSDAY':3,'FRIDAY':4,'SATURDAY':5,'SUNDAY':6} MONTH = {'JANUARY':1,'FEBRUARY':2,'MARCH':3,'APRIL':4,'MAY':5,'JUNE':6,'JULY':7,'AUGUST':8,'SEPTEMBER':9,'OCTOBER':10,'NOVEMBER':11,'DECEMBER':12} year=int(year) …

Member Avatar for mawe
0
2K
Member Avatar for incitatus

can anybody help me by writing a code for opening my web connection. it locks itself after some time as it is password protected and i have to open it again.The thing is that i actually leave my computer on to download stuff and when i come back it locks …

Member Avatar for incitatus
0
112
Member Avatar for dams

Hello, I am new to Python and find it really nice. But I can not launch an executable file using only its name. I have to give its whole path. I expected that the PATH environment variable is known by Python and that it could retrieve the full path itself... …

Member Avatar for dams
0
126
Member Avatar for mattyd

I am in the end part of a Python Gui game build; it is going quite well but I am finding that I underestimated one area of the logic, incorrectly coding it: The game is blackjack. One area that, although it seemed simple on the surface (and in fact it …

Member Avatar for woooee
0
103
Member Avatar for goms

Hi, I am a newbie to python. I was trying to import an execl application to python. To startwith i'm trying to open a excel file using python script. In some of the sample scripts that are available on internet has the following contents. -------------------------------------------------------------------------------- import win32API.client import pythoncom app …

Member Avatar for vegaseat
0
214
Member Avatar for sharma_vivek82

import wx import os from wxPython.wx import * import wx.html class MyHtmlFrame(wx.Frame): def __init__(self, parent, title): wx.Frame.__init__(self, parent, -1, title) html = wx.html.HtmlWindow(self) html.SetPage( "This is test implementation of Simple <b>Notepad</b> using <font color=\"red\">wxPython</font> !!!! " "<br>View is created using <font color=\"red\">wxGlade</font>") class MyFrame(wx.Frame): def __init__(self, *args, **kwds): # begin …

Member Avatar for vegaseat
0
445
Member Avatar for sharma_vivek82

def WeekFinderFromYear(year): """ will return all the week from selected year """ import datetime WEEK = {'MONDAY':0,'TUESDAY':1,'WEDNESDAY':2,'THURSDAY':3,'FRIDAY':4,'SATURDAY':5,'SUNDAY':6} MONTH = {'JANUARY':1,'FEBRUARY':2,'MARCH':3,'APRIL':4,'MAY':5,'JUNE':6,'JULY':7,'AUGUST':8,'SEPTEMBER':9,'OCTOBER':10,'NOVEMBER':11,'DECEMBER':12} year=int(year) month= MONTH['JANUARY'] day=WEEK['MONDAY'] dt = datetime.date(year,month,1) dow_lst = [] while dt.weekday() != day: dt = dt + datetime.timedelta(days=1) lst_month = MONTH.values() lst_month.sort() for mont in lst_month: while dt.month == …

Member Avatar for vegaseat
0
117
Member Avatar for sharma_vivek82

result=[] list = int(raw_input("enter the length of list:")) size_of_batch=int(raw_input("enter the size of batch:")) def createBatch(lst): lenLst = len(lst) if lenLst > size_of_batch: no_of_batch=lenLst/size_of_batch last_entry_batch=lenLst%size_of_batch first_index=0 last_index=size_of_batch else: no_of_batch=0 first_index=0 last_entry_batch=lenLst newList = lst[0:last_entry_batch] runChangeState(result,newList) return while no_of_batch != 0: newList = lst[first_index:last_index] runChangeState(result,newList) first_index=first_index+size_of_batch last_index=last_index+size_of_batch no_of_batch = no_of_batch-1 if no_of_batch==0: …

Member Avatar for vegaseat
0
122
Member Avatar for Matt Tacular

Is there any way to get the python interpreter installed on a thumb drive? So that I can edit some programs while at my work, where I'm never on the same computer twice, so installing on each machine isn't as pratical as the thumb drive. Just anything that would let …

Member Avatar for vegaseat
0
129
Member Avatar for Extremist

Hi there, I am sitting here and thinking. The best way to learn a new language is to play in it, but I have a little problem: I don't know where to start , how about a few ideas

Member Avatar for jrcagle
0
326
Member Avatar for punithap

hai, This is punitha.Iam having some doubts regarding python (python extending with c).In our application python is used as a glue language.It is used to call c funcions(which is in the form of dlls).Once a c function is called,Pyhton variable receives the return value and it passes that value to …

Member Avatar for vegaseat
0
124
Member Avatar for Matt Tacular

I have a function which should work, and it actually does... just not all the time. Sometimes it just freezes. Can anyone identify a problem in the ai_northAmericaCheck(): function? Here is the code: [php] import random ai_countries = [] firstTurnsCountries = [] northAmericaList = [0,1,2,3,4,5,6,7,8,9] availableCountries = range(20) country0value = …

Member Avatar for woooee
0
93
Member Avatar for mattyd

About one month ago or so my Dr. Python compiler (interpreter) died. I had closed Dr. Python to go and eat dinner then came back to re-open and continued where I had stopped and... nothing. This came at a terrible time as I was in the middle of some very …

Member Avatar for Ene Uran
0
189
Member Avatar for jDSL

Hi, this is my first post, and im trying to compare a matrix to find the minus element greater than zero, my list is matrix= [9,8,12,15], [0,11,15,18], [0,0,10,13], [0,0,0,5] I dont want to use "min" function because each element is associated to (X,Y) position. Thanks a lot ! jDSL

Member Avatar for Ene Uran
0
101
Member Avatar for sneekula

I know that one has to be careful with mutable arguments like lists applied to function calls, so that things like this won't accidentally happen: [php]def add_item(list2): list2.append(99) return list2 list1 = [1, 2, 3] list3 = add_item(list1) print list1 # [1, 2, 3, 99] oops! print list3 # [1, …

Member Avatar for jrcagle
0
228
Member Avatar for babutche

Hi, I am trying to average student GPA. I thought I had this problem solved but then I ran it and the GPA did not come out correct. Can anyone give any suggestions? [CODE]import string import math class Student: def __init__(self, name, hours, qpoints): self.name = name self.hours = float(hours) …

Member Avatar for babutche
0
1K
Member Avatar for sneekula

I took a mixed type list and set out to find the min and max values. The results are very surprising to me: [php]mixed_list = [11, 'Dick', 12, 'Mary', 7, 'Zoe', 9, 700, 777, 'Paul', 13456789] mn = min(mixed_list) mx = max(mixed_list) print mn, type(mn) # 7 <type 'int'> print …

Member Avatar for vegaseat
0
3K
Member Avatar for sneekula

I was experimenting with the nested list example in thread: [URL]http://www.daniweb.com/techtalkforums/post246791-72.html[/URL] and was trying to search a nested list like that: [code]nested_list = [1 ,'Dick', 2, ['Mary', 7, 9, [700, 777, 'Paul']], 13] if 'Paul' in nested_list: print 'found Paul' else: print 'Paul not found' [/code]It always tells me that …

Member Avatar for vegaseat
0
105
Member Avatar for sneekula

I want to make a Tkinter button respond to a left and right mouse click differently. How can I do this?

Member Avatar for vegaseat
0
8K
Member Avatar for sneekula
Member Avatar for babutche

Hi, I did get the problem fixed with my "break" not working properly but now my ValueError will not work properly. If you enter a number that is not a floating number it should create a value error(as a matter of fact it did before I fixed my other problem …

Member Avatar for babutche
0
144

The End.