153 Posted Topics

Member Avatar for JoshuaBurleson

How would I define the command of a given button in a messagebox window? i.e. if I were using askokcanel how would I make the ok do a certain action and cancel another?

Member Avatar for JoshuaBurleson
0
104
Member Avatar for JoshuaBurleson

How would I access the string that is in the [1] position of a tuple at a given index of a listbox. What I'm trying to do is something like this:[CODE] a=Lb1.curselection()[1] a=int(a) print(Lb1[a])[/CODE] Lb1 is obviously the listbox. This particular attempt claims 1 is out of range "although I …

Member Avatar for TrustyTony
0
204
Member Avatar for Intrikate
Member Avatar for abders

[QUOTE]I just finished a program[/QUOTE] Well actually you copied the program out of the book, which with no offense to the author, isn't the greatest. I've found a large amount of the code in that book to be a bit buggy, or unclear. The way I got over that was …

Member Avatar for abders
0
210
Member Avatar for dustbunny000
Member Avatar for JoshuaBurleson

I'm having an issue displaying images in tkinter, I've tried the methods suggested by effbot and a couple other sources to no avail. Here are a couple ways I've tried so far:[CODE] gmail=PhotoImage('gmail.gif') self.glab=Label(self,image='gmail.gif') self.glab.image=gmail self.glab.grid(row=3,column=4) gmail=PhotoImage('gmail.gif') self.glab=Label(self,image=gmail) self.glab.image=gmail self.glab.grid(row=3,column=4) self.glabim=PhotoImage('gmail.gif') self.glab=Label(self,image=self.glabim) self.glab.grid(row=3,column=4) gmail=PhotoImage('gmail.gif') self.lab=Label(self,image=gmail) self.lab.image=gmail self.lab.pack() [/CODE]the last one …

Member Avatar for JoshuaBurleson
0
20K
Member Avatar for Vengful

what's the specific problem with the code? Also have you tried livewires? It's a module for pygame and I prefer the simplicity. My first "game" I wrote in it is below, the only thing that would need to be modified would be collision detection on the sprites, and the event …

Member Avatar for Vengful
0
148
Member Avatar for JoshuaBurleson

I hate to complain, but I'm not terribly impressed at the documentation for utilizing binding, it covers quite a bit but not common stuff, or maybe I'm just missing it. I was wondering how I could make the <RETURN> key equivalent to a <BUTTON1> click when a button is highlighted …

Member Avatar for TrustyTony
0
369
Member Avatar for mhillig1

Maybe because of the print imp? I'm not sure, this worked fine for me:[CODE]while True: oinp = open('open_inputs.txt','r') for line in oinp: print(line) oinp.close() print('')#I just needed to make it prettier inp = input('Enter text, or "Enter" to quit: ') if inp == "": break else: oinp = open('open_inputs.txt','a') oinp.write(inp,) …

Member Avatar for JoshuaBurleson
0
1K
Member Avatar for GeoBob
Member Avatar for JoshuaBurleson

I was just wondering if anybody has any ideas on how I could allow a users input to be disguised on the screen when they're entering their passwords (such as the case about everywhere on the internet) i.e. gmail's black dots in place of the actual text of a password. …

Member Avatar for Gribouillis
0
351
Member Avatar for Elektrikz

Post the code here next time, and if you feel it's a good quality code post it as a snippet!

Member Avatar for Elektrikz
0
396
Member Avatar for muthukswamy
Member Avatar for RoqueyB
Member Avatar for RoqueyB
0
2K
Member Avatar for mools3

Both of the above are much better ways to go, but for a simple, not so easy to read solution you could also pickle the dictionary of {username:password} "I'm assuming that's what you're doing pardon me if I'm wrong" to a .dat file. But as I said, this is just …

Member Avatar for JoshuaBurleson
0
117
Member Avatar for JoshuaBurleson

I'm trying to figure out how to deal with multiple matches in my address book, say the user has two people by the name of Bob; one is Bob Lastname and the other is Bob Namelast, how would you approach dealing with telling them to specify, and then allowing them …

Member Avatar for Gribouillis
0
231
Member Avatar for TrustyTony

Nice Tony, it works great! Exactly what I needed, and furthermore, thanks for the link so I could better understand the mechanics.

Member Avatar for JoshuaBurleson
3
2K
Member Avatar for ali13

I would do something like:[CODE]depth=int(input('Depth: ')) def depther(): global depth try: if depth <=50 and depth>0: print(depth) else: while depth>50 or depth<0: print('Incorrect range') depth=int(input('Depth: ')) print(depth) except: print('Invalid input') depth=int(input('Depth: ')) if depth <=50 and depth>0: print(depth) else: while depth>50 or depth<0: print('Incorrect range') depth=int(input('Depth: ')) print(depth)[/CODE] I defined …

Member Avatar for ali13
0
3K
Member Avatar for Thropian

First of all I would personally use pygame for that and livewires(just because) and I would think you'd need to have those parts of the image as separate images, place them on the frame so that they appear to be one image, then you could manipulate them as sprites individually.

Member Avatar for Thropian
0
256
Member Avatar for JoshuaBurleson

I'm having issues with a third level Toplevel in tkinter, that is to say having a toplevel popup from another Toplevel. [CODE] self.emailbttn= Button(self, text='Email', command=self.clientchooser) def clientchooser(self): showing.withdraw() client_choose() def client_choose(): global client client=Toplevel() client.title=('Choose Email') client.geometry=('800x600') Client(client) class Client(Frame): '''Choose Email Client''' def __init__(self,master): super(Client, self).__init__(master) self.grid() self.create_widget() …

Member Avatar for TrustyTony
0
205
Member Avatar for JoshuaBurleson

After marking gofish up to a temporary loss I've moved back to my address book. The issue I'm currently having is that webbrowser is opening the wrong broswer. I've set my default browser to firefox (currently using windows vista), and yet the program is still opening IE, however when I …

Member Avatar for snippsat
0
3K
Member Avatar for imGhostofYou

utilizing modules like that may be a little above your "pay-grade" at the moment, I don't mean that offensively, I'd just stick with running the script. I'm not sure why you want to turn it into an .exe right now anyways, any reason?

Member Avatar for imGhostofYou
0
368
Member Avatar for flyerfile

my netbook is a piece of crap. The charger port has pushed in so far the charger needs to be held in, the battery is shotty and I need a new one. I respect the power of them however, and because they're so inexpensive they're great for tinkering around with …

Member Avatar for jingda
0
296
Member Avatar for JoshuaBurleson

I have no idea what went wrong with my most recent code, but I suspect it has something to do with the following so I'll start there. Did I do something wrong in this? [CODE]cards=['1','1','1','1','2','2','2','2','3','3','3','3','4','4','4','4','5','5','5','5','6','6','6','6','7','7','7','7','8','8','8','8','9','9','9','9','A','A','A','A','K','K','K','K','J','J','J','J','Q','Q','Q','Q'] import random random.shuffle(cards) h1=[] for card in cards[1:7]: h1.append(card) cards.remove(card)[/CODE]

Member Avatar for TrustyTony
0
233
Member Avatar for JoshuaBurleson

I've been on here for a few weeks now and I [B]JUST[/B] found this CI forum, so let me apologize for the late start, "been too busy on Python". I'm a college student, but not in an IT field. Actually I've switched majors so many times it's ridiculous, Elementary Education, …

Member Avatar for jingda
1
282
Member Avatar for king_saqib

While I feel it's probably not necessary as some of the best code in the world is open source and have several other reservations about it, I'll still do the nice thing and answer your question. You could register your work with the U.S. Copyright Office if you wanted to …

Member Avatar for SpiritualMadMan
0
142
Member Avatar for JoshuaBurleson

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 …

Member Avatar for TrustyTony
0
190
Member Avatar for izthrower

it might help to just show us the line of code you're talking about, to be honest it 176 lines is a bit much when you're talking about one section.

Member Avatar for izthrower
0
150
Member Avatar for Weragodalahiru

I agree with Enalicho. However I can suggest that you write out in pseudo-code what you want the program to do. Pay close attention to using the words input and while. Also, think about the number(s) that need to increase and how they may do that. Post some code and …

Member Avatar for JoshuaBurleson
0
113
Member Avatar for JoshuaBurleson

Is there a way to hide or at least automatically minimize the "shell-like" tkinter window, while running it?

Member Avatar for TrustyTony
0
356
Member Avatar for hughesadam_87
Member Avatar for JoshuaBurleson

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?

Member Avatar for JoshuaBurleson
0
307
Member Avatar for abders

Just so you know it's considered polite to mark the thread as solved so people can use it for future reference, and I'm sure pyTony wouldn't mind an upvote for his help if you feel it's in order.

Member Avatar for abders
0
993
Member Avatar for JoshuaBurleson

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]

0
146
Member Avatar for JoshuaBurleson

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][email protected][/email], Phone: (111)555-2222, Address: 122 C---- Ct., Essex, VT']} The …

Member Avatar for JoshuaBurleson
0
2K
Member Avatar for tristanbacon

woooee's list of tuples is quite similar to what I went with, another method would be to create a hand class and have a method to check the hand for face cards and add their values to some variable and check that total maybe something like:[CODE]class class Hand(object): """A black …

Member Avatar for TrustyTony
0
250
Member Avatar for JoshuaBurleson

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, …

Member Avatar for JoshuaBurleson
0
288
Member Avatar for zpzp16

@PyTony do you just write your code in the message body from your mobile or do you have an application for writing code on your mobile? Sorry to digress.

Member Avatar for woooee
0
143
Member Avatar for JoshuaBurleson
Member Avatar for JoshuaBurleson
0
225
Member Avatar for JoshuaBurleson

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?

Member Avatar for JoshuaBurleson
0
263
Member Avatar for Simplicity.

Gribouillis is right, using classes and creating instances would dramatically cut down on bugs like whether the variable your calling is within global scope or not as it would eliminate the need for several global variables. Just in case you're very new and not aware, to utilize a global variable …

Member Avatar for Simplicity.
0
3K
Member Avatar for JoshuaBurleson

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): …

Member Avatar for Enalicho
0
242
Member Avatar for FutureDev86
Member Avatar for TrustyTony
0
323
Member Avatar for JoshuaBurleson

So I've finally fixed up the functionality of an address book I've been writing (not on to utilizing a GUI yet of course though.)However to save or reclaim the data from the last use of the address book I, obviously, need to write and reclaim it from a .txt file, …

Member Avatar for JoshuaBurleson
0
252
Member Avatar for JoshuaBurleson

so I recently wrote a function that sorted using the last value in a tuple. Obviously this couldn't be done simply say sorted(tuples, key=tuples[-1]) because that is not a "legal" call. However I did run across, while trying to figure out how to make things like this work, the utilization …

Member Avatar for nabla2
0
582
Member Avatar for JoshuaBurleson

if I wanted to remove all of the strings within a given list that met a certain criteria, such as having the str'a' in them, how would I go about doing that? the only way that's intuitive to me a for/in loop, but that can't be done. any ideas? Using …

Member Avatar for Enalicho
0
239
Member Avatar for JoshuaBurleson

I'm doing the google code U python class and came across a problem trying the following problem, which is the commented out region, the solution needs to be a function. I'm on the second part and trying to find a way to count the values which meet the requirement,i[0:2]==i[-2:]. I …

Member Avatar for TrustyTony
0
500
Member Avatar for JoshuaBurleson

I got this snippet out of my text book but it's giving me a type error, I'll just give you the whole code, tell me if you get it too, if you would. [CODE]import urllib.request import math whips=int(0) rate=float(4) while rate <= float(20): improve= rate*float(.15)+rate rate= improve whips=whips+1 print(whips) def …

Member Avatar for JoshuaBurleson
0
319
Member Avatar for Russ775

try [CODE]flip=flip+1[/CODE] and remember to hit the code button before you insert your code, it's terrible to read.

Member Avatar for JoshuaBurleson
0
117
Member Avatar for Russ775

The End.