- Strength to Increase Rep
- +5
- Strength to Decrease Rep
- -1
- Upvotes Received
- 16
- Posts with Upvotes
- 16
- Upvoting Members
- 11
- Downvotes Received
- 1
- Posts with Downvotes
- 1
- Downvoting Members
- 1
Experienced Software Engineer with a passion for creating technology improving human life.
- Interests
- JavaScript, TypeScript, C++, Python, Nodejs, Angular, React, Embedded Systems
153 Posted Topics
Re: Uh oh he's using the same book I was using, lol. This worked fine for me:[CODE]from tkinter import * class Application(Frame): def __init__(self, master): super(Application, self).__init__(master) self.grid() self.create_widgets() def create_widgets(self): self.bttn1 = Button(self, text ="I do nothing!") self.bttn1.grid() self.bttn2 = Button(self, text ="Me too.") self.bttn2.grid() self.bttn3 = Button(self, text ="Same … | |
Re: A question on the topic of background colors, is there a way to make an entire Frame's background white, including unassigned space? And, without getting those nasty grey areas around labels and windows? | |
Re: Do you have a link to the CDN for jquery? What does your console output say? | |
Re: [QUOTE=Netcode;1669092]Looks interesting and fun. Thanks for the introduction vegaseat. If i may ask, what good books would you recommend for starters?[/QUOTE] How to think like a computer scientist is great for beginners as is Python programming for the absolute beginner. If you already have experience with a programming language head … | |
Re: Python is a GREAT place to start. You can easily learn the fundamentals of programming with a powerful language that's almost as clear as English. It's been said, and I'm not saying I necessarily agree, that it would be possible to use only Python for anything you ever needed to … | |
Re: [QUOTE=LeonKam;1625020]this is what i am trying to do 1)create a java program for a computer that can send and receive message (Instant messaging) 2)create a java program for a mobile phone (Instant messaging) 3)connect this two application together so both of can receive message from one another.. that's the basic … | |
Re: Matzek, so you know people are much less likely to respond to an old thread, it's advised to start your own. | |
Re: Okay, I haven't been on in a while, let me tell you why no one has replied, you haven't showed ANY effort. Let me see the code you have so far and I'll tell you what you're doing wrong and give you suggestions. This is a simple solution, and you … | |
Re: Don't forget about the reversed() BIF here, it could save you a few lines:[CODE]def is_pal(word): rev_word='' for letter in reversed(word): rev_word+=letter if word==rev_word: return True else: return False[/CODE] likewise, it's much simpler and easier to maintain. | |
Re: Well, with split, just as the name implies you could split the string,into a list, in this case at the semicolon [CODE]>>>a='some;data' >>>a 'some;data' >>>a=a.split(';') >>>a ['some','data'][/CODE] | |
Re: Okay, well what do you need the dictionary to be of? Also, directly copy and paste your code into the[CODE][/CODE] encapsulation so the indentation is correct. | |
Re: fyi, there is no elseif in python... | |
Re: Oh, please tell me someone finally got caught doing that by their teacher. Also think about range, it should take you about 45 seconds to do this program if you just take a moment to think about it. | |
Re: [QUOTE=woooee;1675188]I don't know about anyone else, but I'm getting a little tired of the "I goggled for this" lie [url]http://tinyurl.com/3ldotwl[/url] Perhaps we should boycott the too obvious fibs and point them out as above. Edit: But then I guess that's the same thing, as that's doing the search effort which … | |
Re: The way I'm interpreting it is like:[CODE]that='''450 42.5 16625.0 460 42.0 16820.0 470 41.5 17005.0 480 41.0 17180.0 490 40.5 17345.0 500 40.0 17500.0''' this=that.split('\n') price=None for info in this: data=info.split() if price==None: price=data[1] elif data[1]<price: for info in data: print('XXXX is %s'%info) break[/CODE] output:[CODE]>>> XXXX is 460 XXXX is … | |
Re: issues: -input is a BIF -fix your indentation -think about it; how would you use the functions on anything? That should help you use them in the main() function -I'm sure there are more but I don't feel like analyzing this whole thing with the indentation all messed up, it's … | |
Re: It's quite possible that is because people haven't used that or don't have much experience with it; it's not a matter of not wanting to help. Sometimes you just have to dig and dig to find you own answer, and I'm sure we'd be happy to see the result if … | |
Re: I suggest befriending and/or joining a group of community sites or a community hub. For example many malls and outlet malls have their own facebook pages, if you're in or near that mall you should befriend it and post updates and info on there. Also, several small towns may have … | |
Re: -Are you sure the file is in the same directory as the program calling it? -you don't append to a dictionary, you can append to a value if that value is a list or you can update a dictionary. -if you could you're trying to add the file the dictionary … | |
Re: Well Jose, first how would you determine this matematically? then show us that you've written the pseudo-code. | |
Re: You need to show some effort, but first think about what's happening, obviously it knows the LENgth of the word and displays dashes for letters that haven't been guessed and IF the letter guessed is IN the word then it will show that letter. You need to make the function, … | |
Re: I like dictionaries, I made a function see if you can tell what it does from this:[CODE]>>> grade_buk=[('tom',4),('ben',5),('tom',8),('ben',12)] >>> grades=average(grade_buk) >>> for key in grades: print(key.title()+':',grades[key]) Ben: 8.5 Tom: 6.0[/CODE] | |
Re: well think about how you would skip them...what is the easiest way to distinguish that particular piece of data from the others? To me it looks like maybe it's the fact that data[0] is in ['',' ','\t'] "not sure which it is" where data is the line | |
Re: Why don't you just use a label widget? | |
Re: have you tried a lambda? like:[CODE]>>> lis [(1, 'A'), (3, 'D'), (1, 'Z'), (3, 'F')] >>> >>> fixed=sorted(sorted(lis,key=lambda s: s[1]),key=lambda i: i[0],reverse=True) >>> >>> fixed [(3, 'D'), (3, 'F'), (1, 'A'), (1, 'Z')] >>> [/CODE] | |
I'm trying to use cx_Freeze and everything everything seems like it should work fine, however I'm getting an import error for import tkinter [CODE]Traceback #... from tkinter import __fix #... import_tkinter ImportError: DLL load failed: The specified module could not be found.[/CODE] This only happens when I take the the … | |
Re: well think about what you would need to do; you'd need to either have a list of the images or be in a specified directory to browse through the images in that; some useful tools might be: tkFileDialog, askopenfilename PIL,Image, ImageTk (ImageTk.PhotoImage) os | |
Re: [QUOTE=terry35;1668458]When I open python I am unable write my code in it. This just started to happen no idea what is happening? Its unclickable inside but I can click the bar on top. Anybody know?[/QUOTE] What do you mean? Like you're unable to edit a program you've made, or IDLE … | |
Re: [QUOTE=radiumc;1667586][CODE]file1: /users/ux454500/radpres.tar /paci/ucb/ux453039/source/amr.12.20.2002.tar~ /paci/ucb/ux453039/source/amr.1.25.2003.htar.idx /paci/ucb/ux453039/source/amr.1.18.2003.htar.idx file2: DIRECTORY /paci/ucb/ux453039/. FILE /paci/ucb/ux453039/.ktb_ux453039 05/31/2006 17:52:04 09/01/2007 14:25:33 FILE /paci/ucb/ux453039/source/amr.12.20.2002.tar~ 03/10/2005 20:56:50 09/02/2007 10:35:41 FILE /paci/ucb/ux453039/source/amr.1.25.2003.htar.idx 02/23/2007 14:20:15 08/27/2007 14:53:48 FILE /paci/ucb/ux453039/bhsf1.0000.out 02/23/2007 14:20:13 08/27/2007 14:53:48 FILE /users/ux454500/AIX.mpCC.DEBUG.ex 02/23/2007 14:20:13 02/28/2007 14:47:55 DIRECTORY /paci/ucb/ux453039/runs/bondi file3: DIRECTORY /paci/ucb/ux453039/. FILE /paci/ucb/ux453039/.ktb_ux453039 05/31/2006 17:52:04 09/01/2007 14:25:33 FILE … | |
Re: maybe I'm misunderstanding, but wouldn't something simple like [CODE]def make_norm_lis(entry): lis=[] for letter in entry: if letter.isalpha(): lis.append(letter) else: lis.append(' ') lis=''.join(lis) lis=lis.split() return lis[/CODE] work? [CODE]>>> st='!@#this@#$is//sparta' >>> print(make_norm_lis(st)) ['this', 'is', 'sparta'] >>> >>> work='i.going.to.work' >>> >>> print(make_norm_lis(work)) ['i', 'going', 'to', 'work'][/CODE] | |
Re: There's a sticky on beginner project ideas at the beginning of the forum. Check 'em out. Also there are a couple [URL="http://www.daniweb.com/software-development/python/threads/257510"]more advanced projects here.[/URL] | |
Re: Don't bump old threads...start a new thread with your problem. | |
Re: Why wouldn't you just want the list??? Is it just a matter of printing? If not why not just return a list of integers??[CODE]>>> def renum(lis): return [int(num) for num in lis] >>> a=['1','2','3'] >>> >>> b=renum(a) >>> b [1, 2, 3][/CODE] | |
Re: Also, I tried this with a file someone else posted here a couple days ago, it had a different format, but I feel the idea here is the same, the way I broke it down is just different because of the format:[CODE]File: 115 139-28-4313 1056.30 135 706-02-6945 -99.06 143 595-74-5767 … | |
Re: Post code and ask specific questions, read forum rules and/or pytony's signature. | |
Re: well I've never used graphics but I've used livewires;though I must admit very rarely, however maybe showing you what this "with only one falling snowflake for now" would look like with livewires:[CODE]from livewires import games games.init(screen_width=400, screen_height=400, fps=60) flake=games.load_image('snowflake.png',transparent=True) cabin=games.load_image('snowy_cabin.jpg',transparent=False) games.screen.background=cabin class Snow(games.Sprite): def update(self): if self.bottom>games.screen.height: self.y=games.screen.height/20 snow=Snow(image=flake, x=games.screen.width/2, … | |
Re: Show us some effort, if you've been working on it for three days you must have some code, post it. And use the code tags when you do. Also read the forum rules. | |
Does anybody know how to clear all widgets; labels, buttons, etc. from a tkinter frame so that new ones may be put in their place? I've tried self.destroy() but that makes the frame unreachable, and self.grid_forget() followed by, "and without" self.grid() neither of these work, at least not as expected. … | |
Re: ohhh tony and his one-liners ;-) also, I'm not sure why you thought checking phonebook.items was the most prudent style...I hope you already know what's wrong with that choice; why not phonebook.keys()? | |
Re: Among several other things, you're not telling python to do with that file your opening, you're not going to like the output, how about open(file,'r')... | |
Re: I'm going to over complicate the matter,as to show you step by painful step how the process goes, in my mind that is. I'm not going to make functions either, let's see you re-engineer my code, and hopefully simplify it. Also, post your result. "Note that help.txt was a copy … | |
Re: Don't bump old threads, particularly old solved threads...this one is six years old for goodness sake... | |
![]() | Re: so you know, the function you created doesn't need the parameter word, but if you were abstracting the function, which is often considered better; you could make it something sort of like: [CODE]def no_e(word): noe=word.replace('e','') return noe[/CODE] and then iterate through the words in the file and no_e them. my … |
Re: This is not the place to start python my friend. It's a very easy language to learn, I suggest you check out our Starting Python sticky thread, and there are tons of books on learning python, many of them free. And I've heard Bucky, at thenewboston has a great set … | |
Re: also use code tags when posting code. And as woooee said, this isn't doyourhomeworkweb it's Daniweb, read the forum rules. | |
As most of us know in tkinter in order to properly display an image it must be assigned to a variable, however what if you don't know that amount of images that are going to be necessary? i.e. A friend list, how would one display the friends pictures? | |
I'm trying to utilize partial in order to bind an image to it's associated name in a list "you'll see what I mean" but I'm getting a TypeError thrown on it, this is my first time trying to work with partials so I'm just not quite sure what's going on: … | |
Re: Worked fine for me, line 6 "guess= list(guess)" was unnecessary, when you split it, you're splitting the string into a list. Also, how are you going to account for user error? ie. what if I entered: Shoot: f7, c4, c3, b1, a1 | |
Re: Rev Jim is right, check your algorithm, when you're simply assigning each of them to a random number there's no guarantee that they will all be different. [ICODE]Have an empty array while the length of the array is less than six generate a random number if that random number isn't … |
The End.