15,175 Topics
| |
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] = … | |
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 … | |
[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': … | |
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 … | |
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 … | |
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" … | |
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 … | |
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, … | |
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. … | |
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] | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
I am a student about 4 weeks into learning python, so i do not know a lot, and am hoping someone can help me understand what i am doing wrong, here is the code: [code=python] def main(): name = "TEST" age = 50 makename() makeage() print "You are" ,age ,"years … | |
Hello, I'm playing around with some Python and tKinter and have been wrestling with the idea of an on-screen keyboard that outputs keys-pressed to a text field. I'm familiar with calculators and button input, but would anyone have some thoughts on designing an on-screen keyboard? I'm thinking that I will … | |
Any ideas on how one would force inno to include folders without extracting the data to the program folder, in other words I have support data for my pygame in various folders, the exe I made works fine but when I install the .exe inno takes all the data out … | |
Could someone please tell me why this code will not close my app when the [X] at top right corner is clicked? [CODE]def shutdown(): track.stop() app.destroy() app.protocol("WM_DELETE_WINDOW", shutdown)[/CODE] If you want to see the whole code it's on an earlier post called "Tkinter Scale". Thanks. | |
The python module python-gdata includes an pretty comprehensive example of using python to fetch google calendar events (calenderEvents.py) No matter what I do, I only get 25 events returned. This is the default value of the maximum number of records returned. The example script includes these comments [code] In reality, … | |
In this program I have a lot of game directories in a list like so: [CODE]base = "C:/Program Files/Game" expansion = "C:/Program Files/Game/Expansion" Games = [(base, "Base Game"),(expansion, "Expansion 1")] Installed = [][/CODE] The program then sees if they are installed like this: [CODE]for path, name in Games: #For every … | |
Hi I am sending a text file to a remote app using urllib2. It all works well, but it just seems to take a very long time to send the data. My code is basically doing : TxData = open('OutputFile.txt') data = {'name': 'value', 'file': TxData } f = urllib2.urlopen(url, … | |
Hi, I have written a script that checks whether a line has been added to a file. Whenever, a line gets added to the file a thread is created to process that line. And if a certain conditions holds for that read line, the thread should sleep for 1h and … | |
I need to get the info available devices in my LAN network. My logic is as follows: 1.Send a UDP packet/s to the IP 255.255.255.255 and wait for the response from the available devices, once the devices repond back need to analyze the response.. Please help me out in implementing … | |
I need to show a '&' symbol on a button and I don't understand this - how come [CODE] self.l1 = QLabel("&", self) self.l2 = QLabel(unichr(int("0026", 16)), self) [/CODE] both of these show it on a label but [CODE] self.b1 = QPushButton("&", self) self.b2 = QPushButton(unichr(int("0026", 16)), self) [/CODE] none … | |
Hi ppl,,,,how r ya...hope u r fine.. Just have a lil problem with my program. Im studying civil engineering . And i have problem with my registrations So my friend creatred a program for me ,,but there is something missing in it The main job for this program is to … | |
Hi Guys, I am currently working on the following project: Write a PYTHON function that takes the time as three integer arguments (for hours, minutes, and seconds), and returns the number of seconds since the last time the clock “struck 12.” Use this function to calculate the amount of time … | |
Hi, I'm working in the following project: Write a function in python that displays at the left margin of the screen a solid square of asterisks whose side is specified in integer parameter side. For example, if side is 4, the function displays **** **** **** **** I did this … | |
file = hfmix2.py error is on line 3 [CODE]# imports from Tkinter import * from sound_panel2 import * import pygame.mixer # create gui app = Tk() app.title("Head First Mix") # create mixder mixer = pygame.mixer mixer.init() # call functions panel1 = SoundPanel(app, mixer, "50459_M_RED_Nephlimizer.wav") panel1.pack() panel1 = SoundPanel(app, mixer, "49119_M_RED_HardBouncer.wav") … | |
I have a project due at the end of the quarter. This is my first quarter in programming and we have to create a single player game with at least three modules. I want the game to ask the user to choose heads or tails, then a coin flips and … |
The End.