15,406 Topics
![]() | |
I've been working on getting tkinter to open a window for all dictionary items with keys matching a query. Below is a [B]VERY RAW[/B] piece of code to show what I'm talking about. show() makes the toplevel windows. Also, not that it has so much going on because I isolate … | |
Hi, Last year I posted a question about making graphical representations of sentences, and at the end I did it with matplotlib. Now I wanted to add some more features to it, but I am stuck. you can see the previous post from this [URL="http://www.daniweb.com/software-development/python/threads/282934"]link[/URL] Now, if we assign a … | |
[CODE] Created on Aug 29, 2011 @author: izink001 ''' import pygame from pygame.locals import * from pygame.color import * import pymunk as pm from pymunk import Vec2d import math import sys X,Y = 0,1 ### Physics collision types COLLTYPE_DEFAULT = 0 COLLTYPE_MOUSE = 1 def flipy(y): """Small hack to convert … | |
Does anyone have a idea about this programe, Assume that you are paid on the basis of one cent the first day, two cents the second day, four cents the third day, with the daily amount continuing to double in this way. Design an algorithm and use it to write a Python program … | |
Is there a way to hide or at least automatically minimize the "shell-like" tkinter window, while running it? | |
Hey everyone, I'm checking some bessel functions in python using mathematica, and I can't find anything online about how to import values into python with exponentials. I know how to values with exponents. For example: [CODE]x=2032.43 * 10 **23[/CODE] However, when I read in a data file, say with one … | |
I'm having a terrible time with regular expressions, possibly because I'm using a python2 reference, but maybe not. For example how would I find \s\w within a string and then change that character? | |
I can't seem to find this answer anywhere. All i want to do is write a list of numbers to a file using the file.write() method however i wanted to format the numbers as if i had been using a print statement. When you print you can use %0.2f for … | |
how would I go about assigning more than one value to a dictionary - rather like a list. for example I have students who each have courses. Each student name is a key (unique) e.g as a dictionary student = {"name":"course"} but students can have more than one course student … | |
[CODE]print "creating a text file" text_file = open("write_it.txt", "a") score = 5 name = raw_input("What's your name?: ") score = (score, name) text_file.write(score) text_file.close()[/CODE] getting TypeError: expected a character buffer object Please help. Thanks | |
[code] from Tkinter import * fields = 'Name', 'Job', 'Pay' def fetch(event,entries): for entry in entries: print 'Input => "%s"' % entry.get() # get text print event.widget def makeform(root, fields): entries = [] for field in fields: row = Frame(root) # make a new row lab = Label(row, width=5, text=field) … | |
Hi, I have some .py files that I modify and run. Today I used one of them, and had some output on IDLE python shell. Now I run another .py file, but in between I get the result from the previous code. I tracked it down in the second script, … | |
Hello, I am an intermediate Python programmer, and I was just wondering how is python used on the web? would it be something similar to php, and what software do I need to use in order to use python on the web because I am very much interested in web … | |
Has anyone tried Microsoft's Python Tools for visual studio? I read on /. that it's suppose to support any interpreter not just Ironpython, but I'm only seeing Cpython and Ironpython. Any feedback? [URL="http://pytools.codeplex.com/"]http://pytools.codeplex.com/[/URL] | |
In version 3.0 of my address book I'm utilizing tkinter. The only problem thus far I'm having is that I have a very ugly display on a child window that shows the search result for a query. I'm getting {['Email: [email]Shoiukamp0@gmail.com[/email], Phone: (111)555-2222, Address: 122 C---- Ct., Essex, VT']} The … | |
Hey all, After beating my head against the wall with this, I decided to post. I'm using f2py, a wrapper to call Fortran routines from python. I can't use it because my current version of gcc does not support f2py. According to a posted solution, I have to edit my … | |
This is something that is really starting to bug me about Python and wxPython... In VB6 (Disallowed by my employer) I can have multiple Forms loaded at the same time. I can show and hide each and everyone of these forms any time I want to. For example I can … | |
Again "pseudo-code" for [URL="http://www.daniweb.com/software-development/cpp/threads/379255/1632559#post1632559"]C++ program[/URL]. Quite primitive and simple, but I post it anyway. Generalized to take even even number as parameter. | |
Hello. i have this problem with a program im coding in python. heres the code: [CODE]#! /usr/bin/python from Tkinter import * list=[".", ".", ".", ".", ".", ".", ".", ".", "."] root=Tk() def p(lol): list[0]=1 lol["text"] = list[0] def plade(): ###### ROW=0 a1=Button(root, text=list[0], command=p(a1)) a1.grid(row=0) a2=Button(root, text=list[1], command=p(a2)) a2.grid(row=0, column=1) … | |
Hello all, I am working on a Blackjack program, but am having a bit of trouble with the finer details. At the moment, I have a list of the cards and their values, as follows: [CODE] Jack = 10 Queen = 10 King = 10 Ace = 11 # card … | |
I'm working on learning GUI development, I'm attempting to utilize the GUI for a user to search the dictionary: my code so far is[CODE]from tkinter import * class Interface(Frame): def __init__(self, master): super(Interface, self).__init__(master) self.grid() self.create_widget() def create_widget(self): self.pwrd= Label(self, text='Address Book') self.pwrd.grid(row=0, column=2) self.searchlbl= Label(self, text='Enter Search Query:') self.searchlbl.grid(row=2, … | |
Hello, i'm new to wxpython, i need Your help. So i need to print out the text from let's say file from my computer to a screen that user can see, how should i do it? Thanks for any help! | |
I want to do x=[1,2,3,1,1,2,] y=[1,2] x-y=[3] but when I write z=[set(x)-set(y)] if gave: z=[1,1,2,3] how I can do it? | |
is it possible to use the Fkeys, i.e. F1, F2,...F12, as input in any way? | |
In one of the books I'm using to study Python I keep seeing things like: [CODE] class Application(Frame): super(Application, self).__init__(master): self.grid() self.bttn_clicks=0 self.create_widget"""which is another function in the class"""[/CODE] Why is the super necessary for the class if the class it's calling is itself? | |
Dear Folks, When I iterate within the very bottom function under the comment "#Update conserved quantities" in this module using for loop (see below), I have noticed that the block of statements below it is not iterated, [CODE] """ """ from numpy import * from math import * from scitools.std … | |
Hey everyone, I've tried extensively to find a thread like this already, so I hope it's not a repose. Basically, I have a program with a nice GUI (Tkinter) which has a frame which takes in matplotlib figures. I am able to connect the plots to the Tkinter frame this … | |
I have a very strange problem. I have a python script that uses multi-threading. It works fine, and does exactly what it should. I use several modules that interact with other files. All file handles are closed as soon as they are on longer needed. When I run this script … | |
So I've decided to make some simple animations with python and I came to the issue of getting parts to rotate and move together. I decided to put parts together on a smaller canvas (canvas for the leg placed on the main canvas) but I can't get the canvas to … | |
Hey guys, Just as the title says, I want to implement using an excel spreadsheet as an argument for a python script. I already have the layout of the spreadsheet, but I want to be able to assign the variables in my python script from specific cells of the spreadsheet. … | |
Hello All, Its been a week since I started learning Python, and its been wonderful. This is the problem I am trying to solve. There are 20 text files (In1.txt, In2.txt,....,In20.txt) in a folder. Each text file has 150000 rows. Each of the 150000 rows has a vector of float … | |
Honestly, I am not quite sure how to explain this... I have a 24 Line GUI wxPython Class that has no Events and Two Functions... These Functions are: Clear the Display and Add a Line from the Bottom. I want to use this Frame from beginning to end of the … | |
[CODE]import os import urllib from datetime import datetime import workerpool class DownloadJob(workerpool.Job): def __init__(self, fa): self.fa = fa def run(self): f = open(self.fa + '.txt','w') f.write('Example Note.......') f.close() pool = workerpool.WorkerPool(size=5) def workfile(): range1 = 51 range2 = 102 fam1 = 555 fam2 = 833 ranges = range2 -range1 fams … | |
i have a folder that contains csv excel files that have numbers in the first column labeled 'x', second column label'y', and third column labeled'z'. i was trying to take all of the numbers in the x and calculate the averages and std, take all the numbers in the y … | |
Here's My Problem: I have three Python Modules (using 2.7.2) TC_Config.py merely holds Common Variables used by both of the other two Modules. pyTC.py is supposed to be a Test and Flow Control (Master) Module that once standardized will not be changed (much). ptf.py is a module that will be … | |
Hey everyone, I'm making a data analysis suite in python, and want to construct a custom event handler which will reset the axis based on the data in the current subplot. To do so, I need the event handler to know what data is currently in the subplot. The matplotlib … | |
HELP MR. WIZARD!! I have been using PySNMP for a while, talking to devices and getting values very successfully. I now need to set a TRAP; this is where you tell the device to notify me when something happens, and then you wait for it to happen. I'm guessing that … | |
Hi, I am new in a python2.7. Please help how efficiently we parse and store the fields in dictionary for later retrieval. my log file example #Version: 1.0 #Fields: date time c-ip s-dns x-proto s-parser cs-resource s-resource sc-response-code sc-response s-candidate-ips x-preferred-location x-location cs-user-agent s-ip c-port #Software: vx-logfeed 1.3 #Start-Date: 2011-04-20 … | |
Hi everyone, I'm new here so I hope I've put this in the right place. I'm looking for a little help with a python program I've written. I'm trying to create a timeline from SQLite databases. I take information from a calls database, then an sms database, write those to … ![]() | |
I'm hoping I'm not the first to deal with this issue but here goes. running py2exe I get this error [CODE]Traceback (most recent call last): File "setup.py", line 4, in (module) setup(console=['hello.py']) File "C:\Python27\lib\distutils\core.py", line 152, in setup dist.run_commands() File "C:\Python27\lib\distutils\dist.py", line 953, in run_commands self.run_command(cmd) File "C:\Python27\lib\distutils\dist.py", line 972, … | |
Never did much stuff with "Classes" while still writing in VB6. :) I have the following wxPython Class in my pyTC file [code] class InfoUUT(wx.Frame): def __init__(self, *args, **kwds): # begin wxGlade: InfoUUT.__init__ kwds["style"] = wx.DEFAULT_FRAME_STYLE wx.Frame.__init__(self, *args, **kwds) self.label_1 = wx.StaticText(self, -1, "This TPS is for the following UUT") … | |
Hey guys, I working on an assignment in which I have to write binary/hex to a file. More specifically, I have a variable that holds a memory address that needs to be written to the file big endian but every time I try to write it, python being python treats … | |
Here is simple math program to list number whose all factors are in given set of factors. I have included my timing decorator, which uses my timestring function, so I included that and imports for decorator in the decorator function, bit against the rules. Of course I could have used … | |
I'm trying to understand utilizing classes and their methods. I made a simple program to exit or print 'Will continue' given a word. however I keep getting a TypeError for self and through reading my books and searching online I'm still not quite sure why. the code is: [CODE]class OffSwitch(object): … ![]() | |
I have written some code to count the number of upper case letters in a string and the last line will not work? I am trying to print a statement that concatenates a line of text and an integer variable: [CODE]print ("The number of upper case letters are: " + … | |
I am trying to write code to count the number of upper case letters in a string using Python. I have written the following but instead of the code returning the number of Upper Case letters it returns []? An help would be gratefully recieved. [CODE]import re while True: strPassword … | |
Hi Please take a look at [CODE=python] class ShortInputException(Exception): #QUESTION: Why do I have to inherit from the "Exception" class? def __init__(self, length, atleast): Exception.__init__(self) #QUESTION: Why do I have to add this? self.length = length self.atleast = atleast try: s = raw_input('Enter something --> ') if len(s) < 3: … | |
Hello, I know the break or continue statements for the loops... But I have a if stetement that I would like to exit from and I don't know how to do [code] value = -1 if true: print 'hello world' # Some unexpected value is set so I would like … | |
[CODE]Dim Processors(4) As ProcessorType For j = 1 To 4 Step 1 Put #filenum, WritePos, Processors(j).byte0 WritePos = WritePos + 1[/CODE] I'm in the process of translating this VBA code to python, and essentially what it does is creates 4 Processor Objects but as you can see from the for … | |
hey!! this is my first time to post question in this board. i learn a lots from this place. now , i really got a problem for this programming. anybody can help me!!!! i done "Add" part but i don't konw right or wrong and for "pass" i really need … |
The End.