15,190 Topics

Member Avatar for
Member Avatar for Archenemie

While doing a project i decided to do a mechanism in a panal of its own class, so i could manage the sizers and layout better, then i wanted to take the end result of that panel and display it in my window. Although when i run this code as …

Member Avatar for vegaseat
0
113
Member Avatar for j3nny

How do I convert the integer -2 to its hex 0xfe??? I tried hex() but it gives me -0x2

Member Avatar for jcao219
0
93
Member Avatar for rahul8590

I have various list being generated by a mapper function in this format >>> mapper("b.txt" , i["b.txt"]) [('thats', 1), ('one', 1), ('small', 1), ('step', 1), ('for', 1), ('a', 1), ('man', 1), ('one', 1), ('giant', 1), ('leap', 1), ('for', 1), ('mankind', 1)] >>> mapper("c.txt" , i["b.txt"]) [('thats', 1), ('one', 1), ('small', …

Member Avatar for ultimatebuster
0
259
Member Avatar for sks57

Hi Friends, I want to parse a header file and auto generate a .cpp file. Can any one please suggest me good link in doing so or provide me a sample python script which will automatically generate a .cpp file. I planning to using VC++ pre-build event to call this …

0
17
Member Avatar for lewashby

I'M learning python and I can write very small simple programs with Tkinter or play sound through pygame. I've just started the book "Beginning Game Development with Python and Pygame". I'M in the earlier part of the book and I've just been given the program below. The thing is, even …

Member Avatar for TrustyTony
0
221
Member Avatar for prodigenius

numpy.vectorize takes a function f:a->b and turns it into g:a[]->b[]. This works fine when a and b are scalars, but I can't think of a reason why it wouldn't work with b as an ndarray or list. For example: [CODE=python] import numpy as np def f(x): return np.array([1,1,1,1,1], dtype=np.float32) * …

Member Avatar for TrustyTony
0
396
Member Avatar for personx1212

hello, i created an executable from a python project, with py2exe & cx_Freeze for testing, and both versions work fine on my Windows OS, but none work on other PCs (Win32), when i start the executable it says : 'The application has failed to start because the application configuration is …

Member Avatar for snippsat
0
153
Member Avatar for gonzigg

Hello, im starting a new project, about the game who wants to be a millionaire, so In the beggining I have a Start Button, but I want to know how to set the parameters of the mouse click to be only within the range of the START button. heres what …

Member Avatar for Gribouillis
0
234
Member Avatar for jenzilla

Hello, I'm sure there is a simple solution to this but I cannot seem to find the information I need in my textbook or online. I'm creating a GUI with an entry box for the user to input their name. I then use getText() to retrieve the name they entered …

Member Avatar for rahul8590
0
98
Member Avatar for personx1212

Hello there, i have this problem when i try to combine a variable file name that is in languages other than English with a path, like this : path = 'C:\\Files\' path+=UnicodeName+'.txt' it gives the following error : UnicodeDecodeError: 'ascii' codec can't decode byte 0xda in position 7: ordinal not …

Member Avatar for personx1212
0
116
Member Avatar for Malinka

Hello everybody! I have to go through each subfolder and extract matching strings from each of the files (File_1, File_2, File_3, File_4, etc.). Unfortunately, I don't know how to do that under Linux. I have the following structure: MainFolder: ---Subfolder A ------File_1 ------File_2 ------File_3 ---Subfolder B ------File_4 ------File_5 ------File_6 ---Etc. …

Member Avatar for Gribouillis
0
9K
Member Avatar for nuaris

[ICODE]class classA: #saved as classA.py def __init__(self): print "class A" printB() def printB(): print "B"[/ICODE] [ICODE]>>> classA() class A Traceback (most recent call last): File "<pyshell#0>", line 1, in <module> classA() File "C:\Documents and Settings\Owner\Desktop\timetable\classA.py", line 5, in __init__ printB() NameError: global name 'printB' is not defined[/ICODE] Using the class …

Member Avatar for yinchao
0
2K
Member Avatar for yari

Hi, I've been trying to make a poker game, i got the basic things running like giving the cards to the player and dealer, but i am having trouble coming up with a way to compare the 2 hands... I'm new to python, i tried different ways and didn't really …

Member Avatar for yari
0
3K
Member Avatar for Kraln00b

Hello, I could use a spot of help today. I am very new to python (n00b) and I have a rather specific Issue I am trying to resolve. This problem can be solved using ArcGIS (for those who know it) I simply desire to know more about python so I …

Member Avatar for Kraln00b
0
159
Member Avatar for hisan
Member Avatar for Gribouillis
0
7K
Member Avatar for lionaneesh

I am trying to solve the problem Present at [url]http://www.codechef.com/problems/INTEST/[/url] I have made a small Python script to do my job :- [CODE]array = [] no_lines = 0 no = 0 j=0 div_no=0 no_lines = input() no = input() temp = no_lines while(no_lines>0) : i=0 i = input() array[j] = …

Member Avatar for TrustyTony
0
793
Member Avatar for bettersaid

help! dunno how to convert this in python.. 'contains == ???' in python [CODE]if (basket contains "fruits") then try tell application "Document" to tell application "System Events" to tell application process "Document" to click button "Cancel" of sheet 1 of window "Untitled" tell application "Document" to quit saving no end …

Member Avatar for bettersaid
0
164
Member Avatar for bettersaid

[CODE]from Tkinter import * class ButtonHandler: def __init__(self): self.root = Tk() self.root.geometry('600x500+200+200') self.label = Label(self.root, text=str(self.mousedown)) self.can = Canvas(self.root, width='500', height='400', bg='white') self.can.bind("<Motion>",lambda x:self.handler(x,'motion')) self.can.bind("<Button-1>",lambda x:self.handler(x,'press')) self.can.bind("<ButtonRelease-1>",lambda x:self.handler(x,'release')) self.label.pack() self.can.pack() self.root.mainloop() def mouseDown(self, event ): return 1 def handler(self,event,x): if x == 'press': self.mousedown = 1 elif x == 'release': …

Member Avatar for TrustyTony
0
189
Member Avatar for skumar244

I am pretty new to the Jython world, I have a need to create the jvm custom properties but i am king on struck at array. please provide expertise suggestion.. Here is my code snippet : ### JVM CUSTOM PROPERTIES SCRIPT ### fileOpen = open("/tmp/jvmname.props", "r") fileRead = fileOpen.read() server …

Member Avatar for TrustyTony
0
96
Member Avatar for wezelball

Hi, I can send commands to my TRENDnet TV-IP410 camera using wget as follows: [CODE] wget --user=user --password=password http://192.168.1.140/cgi/admin/ptctrl.cgi?action=move\&Cmd=down [/CODE] This would send the "down" command to tilt the camera. There are also "left", "right", etc. commands What is the best way to do this in python? I could use …

Member Avatar for griswolf
0
125
Member Avatar for krishna_sun82

Hello everyone, I am getting ImportError when I tried to do pure embedding and call Python function from C. The Python code is named dummy.py given by: [CODE=python] def multiply(x, y): print x, y z = x * y return z; [/CODE] It is called by the c program "calldummy.c" …

Member Avatar for krishna_sun82
1
1K
Member Avatar for Hawkpath

Hello all, I'm taking a programming course in python and I have to write a program using certain math functions like pow() and sqrt() and I don't know what to program. Please give me some ideas on programs. I don't need to know how to program them, just what to …

Member Avatar for Gribouillis
0
138
Member Avatar for sial_m

Hello all, I have python 2.6 installed, i can see it in /usr/bin and I can run it in terminal. I cannot however seem to figure out how to open the Idle, or get the program to show in the redhat drop menu. Kinda new to linux (some ubuntu use, …

Member Avatar for Gribouillis
0
352
Member Avatar for zyrus001

I'm looking to write a program that should be capable of holding around 1000 records, each record will contain a varying number of fields and values. Usually, I'd create a list of dictionaries for something like this but wanted to know if that's the right way to go about it. …

Member Avatar for griswolf
0
317
Member Avatar for cleve23

I want to display out text in my panel inside a for loop,but when i use wx.StaticText. It will overwrite the previous sentence. How can i solve this problem??? [CODE]for item in ErrorStorage: print item wx.StaticText(self.p1, -1, item)[/CODE]

0
81
Member Avatar for Peter_TARAS

Hi! I designed a class in Python to do stuffs related to genetic algorithms. I have a method in this class, which should provide a sort of log to keep the track of the populations during the evolution. I mean, I provide the filename as a string argument to this …

Member Avatar for vegaseat
0
17K
Member Avatar for Archenemie

Hi, id like to set values for a botton is wxpython by taking that value from a text file. For this code [CODE]button = wx.Button(parent, label = “x”)[/CODE] and for example on the 1st line of the text file id like to read x. Ive played about with this a …

Member Avatar for Archenemie
0
114
Member Avatar for Tcll

I need help counting the number of times a particular number is used in a text file... and to output a number of results to a text file... eg: [B](input.txt):[/B] 01 40 39 01 72 39 36 56 72 82 39 ### 56 62 38 03 03 06 38 30 …

Member Avatar for Tcll
0
102
Member Avatar for jrcagle

So I was thinking that there would be a simple Pythonic way to delete a directory structure. My app creates and deletes user accounts, which may contain any number of subdirectories and files. Hence, I wanted to do something like: [code] os.rmdir(user_directory) [/code] BUT...that throws an error when user_directory is …

Member Avatar for pythonista
0
139
Member Avatar for technocratic

I have a Python command line program I am attempting to convert into a GUI. Before I bury myself in code does anyone have some advice on this process? Is there a method to simply make everything in the CLI program show up in a tkinter frame? For inputs I …

Member Avatar for technocratic
0
2K

The End.