4,305 Posted Topics
Re: The Geek's Lounge may not be the proper forum for this. You can expect questions like: What kind of repair did damage your file? | |
Re: I know that AddSeparator() works with AddSimpleTool(). Why are you using AddLabelTool()? | |
Re: Go with winpdb free from: [url]http://winpdb.org/about/[/url] | |
Re: You could update to Python 3.1 where '/' is the floatingpoint division and '//' is the integer division. Actually, with Python2 versions, 4./5 would be simpler to type then 4.0/5 or float(4)/5 :) | |
Re: If you simply don't want to show the Tkinter window title and border, you can use this ... [code=python]from Tkinter import * root = Tk() #root.wm_attributes('-alpha', 0.0) root.overrideredirect(1) photo = PhotoImage(file="image.gif") w = Label(root, image=photo).pack() root.mainloop() [/code]Now you have to provide a way to exit, like binding a double-click on … | |
Re: As little as I can remember 1 mile is about 1.6 km, so 1 km is 1/1.6 miles. | |
Re: Generally ... [code=python]if low <= number <= high: # do something [/code] | |
Re: You can print out all builtin Python 'functions' in sorted order this way ... [code=python] print( '\n'.join(sorted(dir(__builtins__), key=str.lower))) [/code]Avoid using any of those names for your variables, or you will get conflicts. | |
Re: This is probably the most common plugin: [url]http://pydev.sourceforge.net/[/url] | |
Re: Well, Python.org is back on and we all solved this problem ... | |
Re: [QUOTE=Bench;295160]Yup, i forgot to clear the state earlier.. The only other alternative to cin.ignore etc.. would be[CODE=CPP]std::cin.clear(); std::cin.sync(); std::cin.get(); [/CODE][/QUOTE] Just a note, cin.sync() is not considered to be very reliable for removing vagabond '\n' characters. No wonder the poor chap through in the C++ towel. | |
Re: All Python GUI toolkits are usefull, 'better' depends on your application, your version of Python, your OS and your skill level. Tkinter: comes with all versions of Python and all Operating Systems. Based on TCL language. It is the best toolkit for the beginner to experiment with, and has lots … | |
Re: Yes, he was a thriller! [QUOTE]It's close to midnight and something evil's lurking in the dark Under the moonlight, you see a sight that almost stops your heart You try to scream but terror takes the sound before you make it You start to freeze as horror looks you right … | |
Re: Python24, Python 25 and Python26 releases each have added a few new functions that Python23 did not have, but the basic functions are all there. Python3 however did change the language syntax somewhat to modernize the language, enough to be a pain. However, there is a conversion utility you can … | |
Re: This works with Windows only ... [code=python]# acts like double-clicking the filename in Windows file manager # starts the associated program and loads the file import os # default file path is the current directory os.startfile("test2.htm")[/code] | |
| |
Re: Wonder how this thing will act after it gets into all those poppy fields over there. | |
Re: pymatio, your code would be easier to read if you would stick with the 4 space indentation that every else uses. Yes, you have managed to mix up tabs and spaces according to my editor. | |
Re: wxPython has a wx.CURSOR_BLANK, but I don't think Tkinter has anything like it. The cursor='draft_small' is about the smallest cursor I have used with Tkinter. | |
Re: For an example of the FileBrowseButton see: [url]http://www.daniweb.com/forums/post930327-114.html[/url] | |
![]() | Re: You are getting into recursion (can get screwy), a while loop will serve you better ... [code=python]def reduce_digits(s): while True: if int(s) < 10: break p = 0 for i in s: p += int(i) #print i, p # test s = str(p) return p #s = raw_input("Enter a number … |
Re: Normally you can find _tkinter.pyd in Windows folder C:\Python25\DLLs. See if you have a similar Python26 folder on your Linux machine. Not quite sure what a DLL is called on Linux or if a .pyd file exists for it. Might need to do a file search for _tkinter.* | |
Re: Module pickle will do it faster and easier. XML format would be used if you want to exchange your data/text with other computer languages. XML looks a lot like HTML, but has more options. | |
Re: On Windows the version installed last will be the default version. Just in case you double click on a Python script file. Some IDE editors like Editra allow you to quickly select the Python version you want to apply to your code (use the Launch plugin). | |
Re: To make a short story long, 'quit' will quit the tcl interpreter of Tkinter! Replace 'quit' with 'destroy' to destroy a particular window in a multiwindow program. | |
Re: [QUOTE=sravan953;930290]BTW, I am not able to edit my first post in this thread, anyone know why? o.O[/QUOTE]You can only edit within 30 minutes after posting. | |
Re: Here is an example for how to use a Tkinter canvas for a background image ... [code=python]# use Tkinter canvas create_image for background # put some buttons on it for testing try: # for Python2 import Tkinter as tk except ImportError: # for Python3 import tkinter as tk root = … | |
Re: You may want to try a binary file read. | |
I just read that the Microsoft Windows 7 OS may appear on PCs by October 22 this year. That is seemingly good news for those of us who are sitting on aging XP desktop PCs in the hope of skipping the dreadful Vista OS. The hope is also for the … | |
Re: Ever wonder how much a suitcase stuffed with hundred Dollar bills would be worth? | |
| |
Re: One thing you can do, is to make the password dots less visible from a distance and clear after entry ... [code=python]# testing wxPython's # wx.TextCtrl(parent, id, value, pos, size, style) # for password entry and masking import wx class MyFrame(wx.Frame): def __init__(self, parent, mytitle, mysize): wx.Frame.__init__(self, parent, -1, mytitle, … | |
Re: Ever wondered if you would be presented with a Jello mold of a naked person, which part you would eat first? | |
Re: There is a little trick to this, you have to assign the dialog's entry instance to the parent, see this example: [url]http://www.daniweb.com/forums/showpost.php?p=921519&postcount=113[/url] | |
Re: The Python functions xrange() and range() only take integer values. For floating point values you have to roll your own function. I called mine frange() ... [code=python]def frange(start=0, stop=0, step=1.0): """similar to xrange, but handles floating point numbers""" if step <= 0: while start > stop: yield start start += … | |
Re: In your first code you are removing all the letters that are in sub (all the 'i' and 's') from the string strng. The challenging part of learning Python is to get to know all the great functions and modules. Actually strings have a function called replace(old, new) that you … | |
Re: The obituaries for Tkinter are premature. Tkinter has been spruced up quite a bit with version 8.5. Also, Python3.1 ships with the extented widget set ttk that includes a treeview widget. Ttk comes with 17 widgets, 11 of which already exist in Tkinter, but are improved: Button, Checkbutton, Entry, Frame, … | |
Re: You neeed to read "Why We Suck" by Dr. Denis Leary, a feel good guide to staying fat, loud, lazy and stupid. | |
Re: This line of code ... def __init__(self, parent, id,content,content,size = wx.DefaultSize): will give an error, since you are passing variable content twice. Also I would replace 'Main.View.Template' with 'Main_View_Template'. | |
Re: Well, you found another interesting web site! Looks like getting in and out of all those sweaters messes up her hair a little. | |
Re: For a sequence with a finite length like you have in str(n), the for loop is ideal. Welcome to DaniWeb! Hope you have fun with Python programming! | |
Re: Save the first script as myhello.py and dont use string since that is a module in Python ... [code=python]# save this module as myhello.py message = "Hello World!" [/code]Nor write your code to test the module ... [code=python]# module myhello.py was saved in the working folder import myhello def output(message): … | |
Re: During the Cold War days the Bulgarians used to have a cyber unit in their military that wrote a lot of virus code. | |
Re: Using tabs for indentation makes your code look so ugly. Can't you just use 4 spaces like most other people? Also, by convention only class names start with a capital letter. | |
Re: No need to use global since lists are mutable objects and are passed by reference to a function. Here is an example ... [code=python]def remove_item(list1, list2, item): """lists are passed by reference so items are removed in place""" if item in list1: list1.remove(item) if item in list2: list2.remove(item) q1 = … | |
Re: Let's hope that it'll be a worthy rival to Windows, particularly if it is as secure as planned. | |
Re: Actually, the empty lines in your data do not contain any spaces. Change the code a little to reflect this ... [code=python]# your data file read() ... data_str = """\ >9|102396631|genome..... CCACTTTCTCTCCGCGCTGGGTTGAACATGGTACATCAGACTCCCTGAATCTGTCAGATC TCTTGGTTGCTGTTGACAACTAAGACTTCGGAGCCTGGAG_GATTTGTTGAGGGGGAGCA GTTCTGGGTGTCCTCTGCTGTGACTGGGCTCCCGGCCTCTTGATAATGCGCAACAGCTGC GGTAGAACATCTCATTCCCAG >9|102362951|ENSRNOS.... """ # create a list of lines # or get the list directly with … | |
Re: A bundle of cash is still the best way to a politician's heart and soul. Don't see how the government would ever want to get rid of it. | |
The End.