15,190 Topics
![]() | |
Hello I have created a multidimensional list in python I used the following code: [CODE] r =[(300, 4), (5, 6), (100, 2)][/CODE] I tried sorting it in ascending order using r.sort() and I get [(5, 6), (100, 2), (300, 4)] I want it to get sorted based on each on … | |
Dear all, I would like to make a small script that does the following: I have a file that at some point there is a section: ... ... a heading is here .... 1 2 3 4 5 6 7 8 9 10 22 22 336 11252 12 25 3 … | |
Hi I am writing some code for a game in python and using sql to store the information for each of the cells. I keep getting a NameError: name 'row' is not defined error. Could someone please help? Below is a bit of the code: [CODE]con.execute("create table Game(row integer primary … | |
A lotto simulator with a twist, you pick the winning numbers and the computer buys the lotto tickets. Anyway, the computer at least generates the tickets and checks how many of them would match the winning numbers you selected. Let's assume you would be the state lotto commissioner and your … | |
Hey all; I had a serious problem occur; after compiling and programming something in python for months, my computer crashed, and the 3 back ups I had of the program crashed within 24 hours after mine, so I lost ALL DATA. The only data I have is the exe program … | |
Hello, I decided I want to make a game where you have to move a ball through a maze and make it to the end without hitting any walls, some of which are invisible!! The game is extremely far from completion, and will be until I learn how to overcome … | |
Hello, I have 2 canvases, which will eventually contain plots made with matplotlib, packed side by side in a Tkinter window. Using mpl_connect with key_press_event and button_press event works fine initially. However, when I pack the second canvas widget the binding to key_press_event stops working. The button press binding still … | |
Hey, I have a problem, if checkboxes is activated, it could be download packages ( Ubuntu ), would be necessary to verify to checkboxes and if it's true, then these packages, which should installed my system ( Ubuntu ). [CODE]#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright (C) 2010 from … | |
I have a homework assignment to instructs me to play around with functions and exceptions, but one seciton I'm stuck with is a certain condition it tells me to write o if x is not "So sue me!", but x is still not convertible to an int (by calling int(x)), … | |
I am writing a tic-tac-toe program and whenever my game gets to here it generates the following error: [CODE]# Display board function def display_board(board): """Display game board on screen.""" print "\n\t", board[0], "|", board[1], "|", board[2] print "\t", "------" print "\t", board[3], "|", board[4], "|", board[5] print "\t", "------" print … | |
I having a little trouble to figure out how can I replace the specific lines in a text file by the lines from another text file marching certain pattern. !?!? For example: I have two files: file1 and file2 , I want to search lines of the first file for … | |
Hi, I am asking here three question together rather than making separate threads for each question. I am making an application where I can load images in a canvas. I load the image with file menu askopenfilename dialog box. Something like this: [CODE]class MyApp(object): def __init__(self, master): frame = tk.Frame(master) … | |
despite its simplicity, for some reason, my code refuses to work, even though the encryption works [CODE] # add() is just (a+b)%2**32. for some reason, without the function, it doesnt work delta = 0x9e3779b9 sum = 0xc6ef3720 for x in range(cycles): # 32 data[1] = add(-add(data[0]<<4, key[2]) ^ add(data[0], sum) … | |
hi i'm new with python and django and i work on search page of my site. in my html search form, user can choose table(or field) which want to search. in server-side i use sequences of 'if' to find chosen table(or field) and related django model. [CODE]... #here assumed searched … | |
Hey guys, I made a class that I am using to save numbers for a larger Ping Pong stat tracker program I am making. I am having problems with it however and can't figure out how to solve it. The class is a basic save to file program. It takes … | |
When I run this code: [code]class C(object): print("Hello from inside class C") [/code]It gives the same result as if I had used this code: [code]print("Hello from inside class C") [/code]However when I use: [code]class B(object): def __init__(self): print("Hello from inside class B") [/code]The class behaves like I had expected. Does … | |
Hi Everyone, I am trying to start ASPEN, a python based web server on my computer. In my Windows 7 command line I input the following: [CODE]python.exe build\scripts-2.6\aspen[/CODE] It then outputs [CODE] launching child process starting child server aspen starting on ('0.0.0.0', 8080)[/CODE] But after I receive that input, the … | |
I am a beginner programmer who is moving on from the basics of python to wxPython. I have the book [I]wxPython in Actio[/I]n and am using it as a reference while I make GUI programs for fun (still haven't sat down and read through the book, will someday). I am … | |
Hi I have been having this issue for a while and cannot figure how should I start to do this with python. Actually Im not a programmer but would like to learn it. Not just because of this (what topic title) says but, for sure, for other advantages to. I … | |
Hi all, My first post here, but long time troller. I was looking for a GUI platform to develop on and couldn't decide between wxPython, PyQT and/or IronPython or Jython. I decided to go with wxPython after getting a couple of headaches elsewhere. I'd really like a quick IDE to … | |
Hi all, Are multiple conditionals at once okay in Python?? So for example: [CODE]if self.combobox.GetValue()!="" [B][COLOR="Red"]and [/COLOR][/B]self.FilePathTextBox.GetValue()!="": [I][functions and objects go here] [functions and objects go here][/I] else: self.SetStatusText('error') [/CODE] Mainly a question on style ... I tried it on my program, and the program seems to work fine. Is … | |
The situation is this: I use opensuse, which bundled with a python 2.4.X version, I installed it. Then I think python 2.6.4 is better, so I installed python 2.6.4 and all the later package I installed, were with python 2.6.4. In my project, I need a module named tkinter (python-tk) … | |
Hi there, using TKinter Is it possible to change a buttons text after you've clicked it? So if a button has text of "hi" and when clicked has text of "Goodbye"? [icode] button_switch = True def click(): global button_switch if button_switch: button_switch = False else: button_switch = True [/icode] This … | |
Hello everyone! I want to use bash from python, however the os.system([I]command[/I]) seems to act only on one command at a time. I want to use complete commands, also containing control flow statements, like If and While, and to call them from python. something like this code in bash: T1="foo" … | |
Hello all together first of all sry for my bad english Well i got a problem with some of my application. First of all i had to write an application which can drag rooms from a source window to 4 destination windows. That works fine . But if i drag … | |
Hello Python community, I have a basic question about the wx.DirDialog method/event handler system and how it works. I had a problem today, but solved it. Basically what I'm trying to do is have a frame, then use event handler wx.DirDialog to open up another dialogue where I can choose … | |
My following question regards a problem I am having remembering python code. It has been about a year and a half since I last opened the shell or wrote any sort of code. I am attempting to rewrite the bullseye program that was seen in the Greater New York Programming … | |
hello, pls, can anybody help? I try to print words which contains forbidden letters but counting without them and excluding the words which has the smallest number of letters. example: words = 'hello this is my test' forbidden = 'h, t, e' 1. hello this test -> these word contains … | |
I need a way to check what service a port is running in python, thanks for the help in advance. | |
This snippet provides 2 functions to create in memory a gziped archive of a sequence of files and directories, and to extract files from this archive. These functions are similar in effect to the linux commands [icode]tar czf[/icode] and [icode]tar xzf[/icode] but instead of writing an archive file on disk, … |
The End.