15,181 Topics

Member Avatar for
Member Avatar for peterparker

A basic program which writes the user name who has logged in the windows machine: ###################### # User info # ###################### import os import datetime from time import strftime def foo(): usr_log = os.environ ['USERNAME'] sys_log = os.environ ['USERPROFILE'] current_time = strftime("%a, %d %b %Y %H:%M:%S") dt_str = str (datetime.date.today()) …

Member Avatar for peterparker
0
209
Member Avatar for vy_007

I'm trying to implement image processing s/w that requires me to implement an image enhancement module that performs various operations like Color, Contrast, Brightness, Sharpness manipulation on the same image. I've implemented a module but it works on the same (original) image and changes done are not reflected. Please help. …

Member Avatar for vy_007
0
927
Member Avatar for mattyd

Located in the upper, left-hand corner of the GUI window is a small "[COLOR=red][B][I]Tk [/I][/B][/COLOR]"; is it possible to get rid of this entirely? It is only a small detail, but a detail none-the-less that I wish to have control over in regards to the final product. I would also …

Member Avatar for ZZucker
0
5K
Member Avatar for vy_007

Below is en2.py code- # The Python Imaging Library # $Id$ # this demo script creates four windows containing an image and a slider. # drag the slider to modify the image. # from Tkinter import * from PIL import Image, ImageTk, ImageEnhance import sys # enhancer widget class Enhance(Frame): …

Member Avatar for TrustyTony
0
7K
Member Avatar for veledrom

Hi, I'm good at PHP and want to learn **Python 3**. Do you know any online pdf book for me to download so I can start? I'm asking to those who can say "this is good one". I found myself googling but I have no idea if they are good …

Member Avatar for Rashakil Fol
0
169
Member Avatar for veledrom

Hi, I was reading about Python and spotted "it has high signal-to-noise ratio" bit. In general, what does it really mean? I read some stuff about it but no particular explanation for programming. Tahnsk

Member Avatar for Rashakil Fol
0
163
Member Avatar for peterparker

################################# # Learning to make a game # ################################# # An attempt to make a game # Each room will be described by a class, whose base class will be Room # The user will be prompted to enter a number, each number will be assigned with a Room in …

Member Avatar for peterparker
0
2K
Member Avatar for TrustyTony

Because of [C++ code snippets not dealing with multiple +-](http://www.daniweb.com/posts/jump/1829367) in sequence (or even negative number) in expressions, I post this, as it is so much easier for me than C/C++. EDIT: Fixed signs together with '(' issues and '+' at beginning removing without lstrip, removed separate now unused '(' …

0
411
Member Avatar for TrustyTony

This is bit funny code as you can first read from this excellent response: http://www.daniweb.com/software-development/python/threads/427341/custom-types-in-a-simple-way#post1828718 why should you not use it, even it maybe feels useful. Anyway I got curious to see how type signature could be implemented, even using it would generally just be stupid way of slowing down …

0
274
Member Avatar for HankReardon

Hello, Can someone please help me with a little problem that I am having splitting strings? I am trying to remove everything more than 2 - digits to the right of a decimal point in a string. For some reason I am not realizing my desired results. If you could …

Member Avatar for HankReardon
0
230
Member Avatar for vy_007

I want to print the histogram of an image in the same window. The given code works fine with viewing the histogram through Windows Image Viewer(default program) but fails to print the required histogram and image in a frame. # RGB Hitogram # This script will create a histogram image …

0
60
Member Avatar for HTMLperson5

Hi, everyone. I am making a tic - tac - toe game and I am having some trouble. As you can see I have made good progress: from os import system a = "1"; b = "2"; c = "3"; d = "4"; e = "5"; f = "6"; g …

Member Avatar for TrustyTony
0
278
Member Avatar for blackarchan

I want to modify the sky to be grey but i want to be time gap between the two...but i dont know how to do it # Import a library functions called 'pygame' import pygame # Initialize the game engine pygame.init() # Define some colors black = (0, 0, 0) …

Member Avatar for peterparker
0
135
Member Avatar for Frensi

# This program runs a test of knowledge #First get the questions #Later this will be modified to use file io def get_questions(): #Notice how the data is stored in a list of lists return [["What color is the daytime sky on a clear day? ", "blue"], ["What i the …

Member Avatar for TrustyTony
0
178
Member Avatar for vy_007

I'm building an image processing appilcation..the problem is I'm not able to import separate scripts in my main script..I want to use them for various functions..but it shows an error.. can anyone tell me the correct procedure to import script defined for various functions.. ` from Tkinter import * from …

Member Avatar for TrustyTony
0
324
Member Avatar for chophouse

I have a question about a better way to do this as what I've written seems clunky. I'm trying to generate 2 variables here that will be used as the date in a BETWEEN clause in MySQL. In order to get the proper construction (YYYYMMDD) I am converting to a …

Member Avatar for chophouse
0
287
Member Avatar for HTMLperson5

Ok, I'm confused, what is the difference between print "stuff" and print("stuff") They both have the same output!

Member Avatar for Gribouillis
0
208
Member Avatar for HTMLperson5

This is a goofy sentence generator I have made in python; it took about 5 minutes to get the code to work - but its working now so if your curious try it out!

Member Avatar for HTMLperson5
-1
557
Member Avatar for zaphoenix

Hi, I am trying to write a code that will calculate easter date within a year range.The problem i have is that no matter what date i put either within or outside the range i get the same output.Here is the code #A programme to calculate date of easter def …

Member Avatar for ZZucker
0
183
Member Avatar for Brickmack

I'm trying to write a program that needs to detect key presses, which I've already done using this code I found online: TERMIOS = termios def getkey(): fd = sys.stdin.fileno() old = termios.tcgetattr(fd) new = termios.tcgetattr(fd) new[3] = new[3] & ~TERMIOS.ICANON & ~TERMIOS.ECHO new[6][TERMIOS.VMIN] = 1 new[6][TERMIOS.VTIME] = 0 termios.tcsetattr(fd, …

Member Avatar for Brickmack
0
327
Member Avatar for skiabox

I have some files, consisting of end of day stock data in the following format : Filename: NYSE_20120116.txt <ticker>,<date>,<open>,<high>,<low>,<close>,<vol> A,20120116,36.15,36.36,35.59,36.19,3327400 AA,20120116,10.73,10.78,10.53,10.64,20457600 How can I create files for every symbol? For example for the company A Filename : A.txt <ticker>,<date>,<open>,<high>,<low>,<close>,<vol> A,20120116,36.15,36.36,35.59,36.19,3327400 A,20120117,39.76,40.39,39.7,39.99,4157900 (I don't want A.txt to contain the first line …

Member Avatar for skiabox
0
192
Member Avatar for werydude

Hello. I am a python noob asking a probably obvious question. I am making sort of a question game, although its still in the debugging stage. The problem is below. (Way below) #A simple game of common knowledge. #Dependecies import time start = "" lv1 = False lv2 = False …

Member Avatar for werydude
0
251
Member Avatar for ryan461

I've got an XML file that looks like this: <routingTable> <router> <id>1</id> <ip>1.1.1.1</ip> <nexthop>1.1.1.2</nexthop> </router> <router> <id>2</id> <ip>2.2.2.1</ip> <nexthop>2.2.2.2</nexthop> </router> </routingTable> With possibly more than two router entries as time goes on. What I would like to do, is take each router instance and throw it into a dictionary. This …

Member Avatar for ryan461
0
210
Member Avatar for shean1488

Hi everybody, Explain me please what I'm doing wrong. So I'm trying to create a database and store data, that I get from django forms. Everything looks fine, and when I manually check database it shows that it recieved a new row, however my browser gives me this message and …

Member Avatar for TrustyTony
0
4K
Member Avatar for smile1

I have the following code where I have several small problems. I have included some comments as I can't seem to get my 'pop up menu' button to work in order to retrieve the number of columns requested by the user. I then need to be able to get the …

Member Avatar for woooee
0
2K
Member Avatar for elyos

Hi guys! I start using Python few days ago, for a game server ( it'a an online game ). I made a server for that game, I start it on my pc, and for do this I need to start Server.py too, or, it wouldn't connect to the server. I …

Member Avatar for elyos
0
293
Member Avatar for mimobe

Hello everybody, I'm trying to improve an application i found at this link [Click Here](http://www.alcrypto.co.uk/satmap/tkinter-video.py) which can load and play a video file .avi or .ogg. My problem is as follows: I'm unable to load another video file though i have access to the dialog box. In addition to that, …

0
191
Member Avatar for skiabox

I have a group of files (A.txt, AA.txt etc) in the form A.txt : A,45,56,78,98,11,23 A,98,90,33,76,30,40 AA.txt : AA,65,76,34,76,98,12 AA,12,76,33,76,33,89 How can I quickly remove the symbol column (A,AA) from all these files using Python? (I want to use python because the number of txt files is 3200) Thank you.

Member Avatar for Gribouillis
0
166
Member Avatar for pythonstudent11

I am in course that uses Gaddis' Starting Out With Pyton 2nd Edition. There is a problem in the course that asks use to write a program that would capitalize sentences that a user inputs. I have come up with a reasonable solution, but I have two major problems. The …

Member Avatar for alexgwhiz69
0
5K
Member Avatar for rokkamraja

Hi, I know how to get the current active window in Python using PyWin32 api's . However, whenever I get the name of a particular window, I need to log the keystrokes in that window. How would I go about doing this ? Thanks, Raja.

0
55

The End.