15,181 Topics

Member Avatar for
Member Avatar for imperialguy

I use: Python 2.6 and sqlalchemy 0.6.1 This is what I am trying to do: from sqlalchemy.types import ( Integer, String, Boolean ) from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() class SampleMeta(type): def __new__(cls, name, bases, attrs): attrs.update({ 'id': Column('Id', Integer, primary_key=True), 'name': Column('Name', String), 'description': Column('Description', String), 'is_active': Column('IsActive', …

Member Avatar for Gribouillis
0
403
Member Avatar for kdar

How do I go about writing a python application for windows mobile 6.1 or 6.5? I need to write one application (simple application, except for need for SQL support) for Windows Mobile. I been trying to decide which language is better to use. At first I tried to install Windows …

0
76
Member Avatar for Empireryan

Hi all. I'm wondering if it is possible to pass formatted strings to function arguments. I'm doing something like this: `OUT_TASK = "Task_{id1}, FUNCTION, {id2}, task{id3}_types, None"` `t = Task(OUT_TASK.format(id1=i, id2='doNothing', id3=i))` Any clues are much appreciated. Any other means for doing variable arguments are of interest.

Member Avatar for snippsat
0
222
Member Avatar for srinivas.rambha

import serial import threading import Queue import Tkinter as tk class SerialThread(threading.Thread): def __init__(self, queue): threading.Thread.__init__(self) self.queue = queue def run(self): s = serial.Serial('COM10',9600) while True: if s.inWaiting(): text = s.readline(s.inWaiting()) self.queue.put(text) class App(tk.Tk): def __init__(self): tk.Tk.__init__(self) self.geometry("1360x750") frameLabel = tk.Frame(self, padx=40, pady =40) self.text = tk.Text(frameLabel, wrap='word', font='TimesNewRoman 37', …

Member Avatar for m_ishwar
0
1K
Member Avatar for m_ishwar

Hey guys is there a funtion in python that enables to output values to a bin files? Just like storing strings in .txt files, can we store hexadecimal values directly into .bin files? I am working using Python 2.7.3

Member Avatar for m_ishwar
0
313
Member Avatar for zaphoenix

hi, Please can anybody help me with this problem, i am creating an application that outputs to a notepad file on windows 7, i would like to know if there is a python module that i can use to invoke a notepad file(example trial.txt) to output into.THanks

Member Avatar for pbj.codez
0
239
Member Avatar for Pallab.Bhk

Hey I have dictionary like following one dicts = {'met_293': ['81.0175','4','7','7','29.76','23','1','0','22','28.57','2','[KG]EHY'],'met_394': ['79.9579','4','7','7','29.76','18','3','0','15','28.57','2','EHY[ILV]'],'met_309': ['81.0175','4','7','7','29.76','23','1','0','22','28.57','2','[KG]EHY'],'met_387': ['79.9579','4','7','7','29.76','18','3','0','15','28.57','2','EHY[ILV]']} I want to remove keys which have same value like 'met_293' and 'met_309' those two keys have same value at 12th position which is '[KG]EHY' so i want my dictionary like this {'met_293': ['81.0175','4','7','7','29.76','23','1','0','22','28.57','2','[KG]EHY'],'met_394': ['79.9579','4','7','7','29.76','18','3','0','15','28.57','2','EHY[ILV]']} any …

Member Avatar for Pallab.Bhk
0
485
Member Avatar for Benkku

I was trying to calculate the angle between two points using math.atan2(y, x) as was suggested in numerous forums and tutorials. After trying it myself, it didn't quite work as charmingly as it did for others. So I made a simple example of what it does and I need some …

Member Avatar for Gribouillis
0
430
Member Avatar for Matigo

Hello everyone How can i make the button be on the left side or right side please Part of the code Button(self, text = "start", command = self.launch).grid(row = 7, column = 0, columnspan = 1,) Thanks in advance

Member Avatar for bumsfeld
0
217
Member Avatar for Jacklittle01

I am trying to make a system for my game in which the player's enemy has a decreasing amount of health. My shell output is here: Cannon Fired! Enemy Health= 8 Cannon 1 ammo = 10 The enemy fired back! Your health is now 12 Fire your choice of cannon! …

Member Avatar for Jacklittle01
0
148
Member Avatar for Jacklittle01

In my game, I am trying to make it so when the enemy's health equals 0, the player advances. I used a while statement and a true or false variable. When the enemy health is less than or equal to 0, the program exits the while statement. It does not …

Member Avatar for sepp2k
0
117
Member Avatar for Jacklittle01

In a combat system, how would I have a certain raw_input repeat until the enemy is dead?

Member Avatar for sepp2k
0
81
Member Avatar for Matigo

Hello everyone I'm building my first app using Python TkInter and i would like to have someone help me with this I want to make a checkbox by default it should be False (Unchecked) And make it do something like (Sorry i only know how to do it on visual …

0
95
Member Avatar for Jacklittle01
Member Avatar for slate
0
298
Member Avatar for bilashcse

I need some help for python AI. I can't understand some codes for python AI. I need to understand this code. So please help me. code : def __str__(self): if self.nature is 'AI': return self.name+' ('+self.nature+')'+' as '+self.colour else: return self.name+' as '+self.colour In this code 'AI' is used. But …

Member Avatar for m_ishwar
0
167
Member Avatar for theholychilli

I am creating a pokemon text-based game. I have 1 problem, I dont know how to do the attacks. I thought - enemyHP = 100 class pikachu: def slamAttack(self): self.enemyHP = enemyHP - 30 print("pikachu used slam!") print(enemyHP) #then to call it when they ask for slam attack = str(input("OPTIONS: …

Member Avatar for m_ishwar
0
608
Member Avatar for john.rickley

Hey, I m writting this python program and I need to have the user enter a password. As with all passwords, if it is correct then the program proceeds. if not, then it halts there. What code should I use for this?

Member Avatar for slate
0
179
Member Avatar for goutham.tandra

i don't know anything about django.. but i want like google while we are searching data in one tab and if we open new tab we getting new search page... am doing one task in my office but if i open new pageam getting last saved values.. so please help …

0
74
Member Avatar for natehome

im trying to get this script to draw a line from the center of the rectangle to the mouse BUT i only want it to draw about 10 pixels out. how can i find that point that is 10 pixels(or points) out? code so far: import pygame from pygame.locals import …

Member Avatar for natehome
0
305
Member Avatar for andrew.makkink

My opensuse 12.came with python 2.72 installed. How can I update that and two, which editor would be reccomended? Thanks but please this is my first attempt at linux

Member Avatar for andrew.makkink
0
130
Member Avatar for Lardmeister

When I run: [code]dec = 255 print hex(dec) [/code]I get 0xff, but I like to get just 'ff'

Member Avatar for bumsfeld
0
5K
Member Avatar for happygeek

There are precious few archaeologists in Japan, and only a handful who produce their own software programs to analyze geographic information. One who does is Professor [Izumi Niiro](http://www.okayama-u.ac.jp/user/arch/about/niiro.html) of the Okayama University. A convert from Perl, Professor Niiro now uses Python to perform data analysis via the Geographic Resources Analysis …

1
461
Member Avatar for No_idea

hi, I want to load an unknown number of buttons (20 max) into a panel. When clicking a button, some other code should be executed. Below code shows my attempt at solving the problem. Unfortunately execution results in an assertion error. Any help in pointing me in the right direction …

Member Avatar for No_idea
0
228
Member Avatar for shahinalam07

Given: A string s of length at most 200 letters and four integers a, b, c and d. Return: The slice of this string from indices a through b and c through d (with space in between), inclusively.

Member Avatar for stbuchok
0
101
Member Avatar for m_ishwar

Guys! I would like to know if it was possible to create an assembler using python since it has excellent string handling features. Any Ideas how it could be done?

Member Avatar for m_ishwar
0
154
Member Avatar for farhaana.ahmed.58

i have a text document 'topics.txt': 1~cocoa 2~ 3~ 4~ 5~grain~wheat~corn~barley~oat~sorghum 6~veg-oil~linseed~lin-oil~soy-oil~sun-oil~soybean~oilseed~corn~sunseed~grain~sorghum~wheat 7~ 8~ 9~earn 10~acq and so on.. here the numbers correspond to the file names, i have about 20000 files. import os import re import sys sys.stdout=open('f1.txt','w') from collections import Counter from glob import glob def removegarbage(text): text=re.sub(r'\W+',' …

Member Avatar for chriswelborn
0
247
Member Avatar for Jacklittle01

I compiled a program in python, but the second I open it, there is a flash of the error, but then the cmd window closes.

Member Avatar for aVar++
0
102
Member Avatar for wolf29

I have 2 functions, one of which works and one of which doesn't. I do not understand this, because the only difference is that the second function puts in just the name of the variable, where the 1st function puts in the value. There is only one line to build …

Member Avatar for wolf29
0
316
Member Avatar for jpk1a873

I have to create a python program for class- the instructions are- Write a payroll program that pays time and a half for anything over 40 hours. This should have 3 functions in #addition to main. Which I did without the 3 funcitons. def main(): hours = float(input('How many hours …

Member Avatar for woooee
0
8K
Member Avatar for ibpet11

Hello guys, Please how can I read xml files and extract image store in it and save it as .jpeg in a specified folder. Also how to export all the other fields to .csv or .txt file. Thank you.

0
65

The End.