what if you mark it solved? :icon_razz:
Ghostenshell commented: Thanks for the help +1
what if you mark it solved? :icon_razz:
first, it is better to use code tags.
Having that said, it seems the PDF is encrypted. So try something not encrypted or check for decryption option if available in pyPDF module (I have never used it)
+1 for Jlm699
Nothing new but using modules' returned value is same as functions
def addition(a, b):
c = a+b
return c
summ = addition(2, 3)
print summ
The only difference is, the module is imported and uses as you always access module methods
assume that is in module named math_module
import math_module as math
summ = math.addition(2, 3)
print summ
Thank you everyone.
You are welcome!
Daniweb didn't allowed me to edit my mistake so I will repost the code
just to get a clue of things:
string = raw_input("Enter Number: \n")
print type(string)
integer = int(string)
print type(integer)
floating = float(string)
print type(floating)
just to get a clue of things:
string = raw_input("Enter Number: \n")
print type(string)
integer = int(string)
print type(integer)
floating = float(string)
print type(floating)
I realized latter that this is maliciously asked question!
I flagged it bad post, si I hope moderators will deal with this sturbborn creature! lol:
What's a search engine?
is a website that helps you get what you want from net!
http://en.wikipedia.org/wiki/Search_engines
try to see:
www.google.com
www.altavista.com
www.dogpile.com
www.metacrawler.com
Here is simple example on class and methods. Get the whole taste from dedicated tutorial like here:
http://docs.python.org/tutorial/classes.html
# simple classexample
class Car():
def accelerate(self, speed):
acceleration = speed+1
return acceleration
def deccelerate(self, speed):
deccel = speed-1
return deccel
# now we will make use of class
#first make instance of that class
car_speed = Car()
speed = 5
print "The car started with speed %d m/s" %(speed,)
speed = car_speed.accelerate(speed)
print "Now car is moving at %d m/s" %(speed,)
speed = car_speed.deccelerate(speed)
print "Now car is moving at %d m/s" %(speed,)
Are you guys putting the code into the interactive python interpreter or are you creating a separate .py file. When I started my first pygame project, I tried putting it in the interpreter and got an Not Responding window. Of course I just started python and pygame so what do I know :P.
Why not try to run it from IDEs like Drpython, or Wing 101 and tell us the progress
I would suggest you write and run your code on an IDE made for Python code, something like IDLE or DrPython. Otherwise your output window will be set to the OS command window colors.
And Wingware's Wing IDE if you need simple debugging
There are many code editors out there that cater to Python and do the proper indentation for you after you type a statement with a colon.
I have been afraid of Vim editor, due to NO-knowledge. But today I found a nice book from Swaroop C.H.
I will go back and practice it. So I suggest for anyone intereseted to check the link. Big blow to Emacs guys (I found them always debating which is the best. I hope this will credit more vim guys) :)
You may not have a problem with your tabs and your tab setting, but I have run into plenty of problems with other folks' code that have used tabs. Please avoid tabs!
Noted!
I'll convert all my codes to spaces with my Wing IDE
Thanks for that
from my experience, they should be avoided. Most editors support converting tab key hits into spaces.
I use one tab or four spaces
They give me no problem, so I guess:
1Tab = 4spaces
anything from w2k to Vista
Don't worry very simple
1. Install PEbuilder
2. download and add password plugin via PEbuilder (Cab not zip)
3.Build ISO image
4. Burn image to disc
5. Boot disc with defective computer
NB: For native XP-like enviroment, consider adding XPE plugin
Hope you will make it
Steve
Next time remember to create at Least TWO admin accounts for safety. That will help in case of problem in one account.
Since problem is at hand, the best way to handle it is learning here:
http://www.nu2.nu/pebuilder/
http://www.google.co.tz/search?q=pebuilder&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a
and check password plugin:
http://www.bootcd.us/BartPE_Plugin_Details/384/Windows-Password-Renew-1_0-RC2.html
add that one and boot with disk and you will be able to change password with it!
Note: Be respectful to others' privacy as this CD is very powerful yet dangerous.
why not put in My documents or elsewhere? I count working in python folder as dangerous practice that I avoid
print 'What is you name?'
Raw_input()
If you run it you will get error
NameError: name 'Raw_input' is not defined
That is because your version of raw_input() is Raw_input()
my friend, use code blocks when posting codes so as to preserve the most valuable indentation
Not only Run, but also debug, which is missing in IDLE. There is also browser for classes and methods if you have long code. I used for sometime 101 version before I bought the personal Edition. After I master well the Language I will go for Pro version. From my point of view, 101 verion is best than many free IDE available and too superior to compare with IDLE
Dont take me at my word, do it yourself
www.wingware.com
why not use Wing IDE? It have been my IDE for python. I have tried many; SPE, Pyscripter BOA, etc and found Wing IDE both easy and Powerful. If you don't Like to pay $ there is 101 version with stripped feature but have Editor, Run/Debug, Methoda/Class browser!
I suggest it, but again it is a matter of preference!
sample code??
Are you using TextCtrl or what?
Proportionality is missing. Also you can add wx.EXPAND for widgets to fit your sizer better
import wx
class MainWindow(wx.Frame):
def __init__(self, parent, id, title):
wx.Frame.__init__(self, parent, wx.ID_ANY, title, size=(400,200), style = wx.DEFAULT_FRAME_STYLE | wx.NO_FULL_REPAINT_ON_RESIZE)
#-- I think you need a panel if you're going to have more than one control in your frame.
panel = wx.Panel(self, -1)
#--- Create the Username label and text box and add them to the panel
#--- I think the TextCtrl needs to have self. at the front for the value to be used by
#--- the Process() function below. There must be a better way.
self.txt_Username = wx.TextCtrl(panel, 1, size=(125, -1))
lbl_Username = wx.StaticText(panel, -1, "Username:")
#-- Create the Password label and text box and add them to the panel
self.txt_Password = wx.TextCtrl(panel, 1, size=(125, -1), style=wx.TE_PASSWORD)
lbl_Password = wx.StaticText(panel, -1, "Password:")
#-- Create the processing button, add it to the panel and wire it up to a function in the class
btn_Process = wx.Button(panel, -1, "&Process")
self.Bind(wx.EVT_BUTTON, self.Process, btn_Process)
#-- Create the close button, add it to the panel and wire it up to a function in the class
btn_Close = wx.Button(panel, -1, "&Close")
self.Bind(wx.EVT_BUTTON, self.onExit, btn_Close)
#-- Now we have to create a grid to layout our controls
#format--> sizer.Add(widget_to_add, proportion,spacing btn widgets )
#Also using Flexigrid sizer use AddMany for simplicity
sizer = wx.FlexGridSizer(rows=3, cols=2, hgap=5, vgap=10)
sizer.Add(lbl_Username,0, wx.LEFT|wx.TOP| wx.RIGHT, 5)
sizer.Add(self.txt_Username,0, wx.TOP| wx.RIGHT, 5)
sizer.Add(lbl_Password,0, wx.LEFT|wx.TOP| wx.RIGHT, 5)
sizer.Add(self.txt_Password,0, wx.TOP| wx.RIGHT, 5)
sizer.Add(btn_Process,0, wx.LEFT|wx.TOP| wx.RIGHT, 5)
sizer.Add(btn_Close,0, wx.TOP| wx.RIGHT, …
Basic example with for loop
#URL LIBRARY
from urllib2 import *
ur = urlopen("http://www.daniweb.com/forums/thread161312.html")#open url
contents = ur.readlines()#readlines from url file
fo = open("test.txt", "w")#open test.txt
for line in contents:
print "writing %s to a file" %(line,)
fo.write(i)#write lines from url file to text file
fo.close()#close text file
mypocket = ("gum", "wallet", "old kleenex", "bus ticket")
input_user = int (raw_input('How many item you need ? \n'))
for i in range(input_user):
print mypocket[i],
#this will print from first to the limit of range
#No catching of exceptions
#use random module to randomize selection
+1 for Paul & Vega
I have not used it, But I know pyInstall exists
Amen! Mark it solved!
Sorry, I forgot (I actually didn't knew it was not there) to attach your panel to whole layout
Here is rectified code
Enjoy!
import wx, os
WINDOW_WIDTH = 500
WINDOW_HEIGHT = 500
ID_ABOUT=101
ID_EXIT=110
class MainFrame(wx.Frame):
"""Recall Roster"""
def __init__(self, parent, id, title):
wx.Frame.__init__(self, parent, id, title, pos = (200,75), size = (WINDOW_WIDTH, WINDOW_HEIGHT))
self.background = wx.Panel(self)
self.changeok = True
# initial import of saved information
if os.path.exists("recall roster pkl.pkl"):
import pickle
pkl_file = open("recall roster pkl.pkl", "rb")
self.member = pickle.load(pkl_file)
pkl_file.close()
print len(self.member), "members loaded"
else:
self.member = []
print "new list created"
self.member_names = []
for x in self.member:
self.member_names.append(x[0])
filemenu= wx.Menu()
filemenu.Append(ID_ABOUT, "&About"," Information about this program")
filemenu.AppendSeparator()
filemenu.Append(ID_EXIT,"E&xit"," Terminate the program")
menuBar = wx.MenuBar()
menuBar.Append(filemenu,"&File")
self.SetMenuBar(menuBar)
wx.EVT_MENU(self, ID_ABOUT, self.OnAbout)
wx.EVT_MENU(self, ID_EXIT, self.OnExit)
#buttons
self.EditMemBtn = wx.Button(self.background, label = "Edit Member")
#self.EditMemBtn.Bind(wx.EVT_BUTTON, self.OnEditMem)
self.DelMemBtn = wx.Button(self.background, label = "Delete")
#self.DelMemBtn.Bind(wx.EVT_BUTTON, self.OnDelete)
self.NewMemBtn = wx.Button(self.background, label = "New Member")
#self.NewMemBtn.Bind(wx.EVT_BUTTON, self.OnNewMem)
#search tools
self.searchbox = wx.TextCtrl(self.background, style = wx.TE_READONLY)
#self.searchbox.Bind(wx.EVT_CHAR, self.searchevent)
self.searchbox.SetEditable(True)
self.search_text = wx.StaticText(self.background, label = 'Search')
# statusbox and listbox
self.status_box = wx.TextCtrl(self.background, style = wx.TE_READONLY | wx.LB_SORT)
self.lbox = wx.ListBox(self.background, 26, wx.DefaultPosition, (170, 130), self.member_names, wx.LB_SINGLE)
#self.lbox.Bind(wx.EVT_LISTBOX, self.OnHighlight)
# add new member button and search static text
self.hb_9 = wx.BoxSizer() #build edit side
self.hb_9.Add(self.EditMemBtn, proportion = 0, border = 0)
self.hb_9.Add(self.DelMemBtn, proportion = 0, border = 0)
self.hb_9.Add(self.NewMemBtn, proportion = 0, border = 0)
# search box then search button
self.hb_1 = wx.BoxSizer()
self.hb_1.Add(self.search_text, proportion = 0, border = 0)
self.hb_1.Add(self.searchbox, proportion …
I mean while installing the wxpython is when you right click wxpython and run the setup as admin. try to get the latest.
Did what traceback error does it give anyway??
I have the same and it works for me. Try re-installing wxpython but raise it to admin level by right click, run as admin and feeback
What I can suggest is:
go to www.avast.com and download avast Home edition.Register to get the keys for free
Download it and install it. Remove all other antivirus. Download comodo security and install the package except antivirus. update it (on misclaneous tab). Right click on avast GUI and select boot schedule option. Restart at prompt(select yes restart) Let it scan. Then scan malware using comodo. After that cleaning, you can do cleaning also using spyboat.
Good time!
Steve
Wxwidgets is a toolkit for making GUIs in C++ and python cannot access that toolkit. What is done is; python language is "Glued" or bound to that C++ widgets so that you can access it using normal python code.
Wxpython is the glued version of wxWidgets. I don't know details of "gluing" process though!
It work for me in Idle
Just check for installation! What windows and version/linux do you use??
Have you tested my above code? It works for me with menu bar but the only weird thing is, the things are not well arranged in sizer. If above code doesn't work for you then something is wrong with your installation may be!
BTW how do you run it? Commandline or IDLE/IDE?
Your problem isn't menubar, it is that, you have added bound self to events that doesnt exist. What I have done is, I have added two of them and commented out all the rest. So Go and define those events and then rearrange the stuffs in sizers in smart way!
import wx, os
WINDOW_WIDTH = 500
WINDOW_HEIGHT = 500
ID_ABOUT=101
ID_EXIT=110
class MainFrame(wx.Frame):
"""Recall Roster"""
def __init__(self, parent, id, title):
wx.Frame.__init__(self, parent, id, title, pos = (200,75), size = (WINDOW_WIDTH, WINDOW_HEIGHT))
self.background = wx.Panel(self)
self.changeok = True
# initial import of saved information
if os.path.exists("recall roster pkl.pkl"):
import pickle
pkl_file = open("recall roster pkl.pkl", "rb")
self.member = pickle.load(pkl_file)
pkl_file.close()
print len(self.member), "members loaded"
else:
self.member = []
print "new list created"
self.member_names = []
for x in self.member:
self.member_names.append(x[0])
filemenu= wx.Menu()
filemenu.Append(ID_ABOUT, "&About"," Information about this program")
filemenu.AppendSeparator()
filemenu.Append(ID_EXIT,"E&xit"," Terminate the program")
menuBar = wx.MenuBar()
menuBar.Append(filemenu,"&File")
self.SetMenuBar(menuBar)
wx.EVT_MENU(self, ID_ABOUT, self.OnAbout)
wx.EVT_MENU(self, ID_EXIT, self.OnExit)
#buttons
self.EditMemBtn = wx.Button(self.background, label = "Edit Member")
#self.EditMemBtn.Bind(wx.EVT_BUTTON, self.OnEditMem)
self.DelMemBtn = wx.Button(self.background, label = "Delete")
#self.DelMemBtn.Bind(wx.EVT_BUTTON, self.OnDelete)
self.NewMemBtn = wx.Button(self.background, label = "New Member")
#self.NewMemBtn.Bind(wx.EVT_BUTTON, self.OnNewMem)
#search tools
self.searchbox = wx.TextCtrl(self.background, style = wx.TE_READONLY)
#self.searchbox.Bind(wx.EVT_CHAR, self.searchevent)
self.searchbox.SetEditable(True)
self.search_text = wx.StaticText(self.background, label = 'Search')
# statusbox and listbox
self.status_box = wx.TextCtrl(self.background, style = wx.TE_READONLY | wx.LB_SORT)
self.lbox = wx.ListBox(self.background, 26, wx.DefaultPosition, (170, 130), self.member_names, wx.LB_SINGLE)
#self.lbox.Bind(wx.EVT_LISTBOX, self.OnHighlight)
# add new member button and search static text
self.hb_9 = wx.BoxSizer() #build edit side
self.hb_9.Add(self.EditMemBtn, proportion = 0, border = 0)
self.hb_9.Add(self.DelMemBtn, proportion = 0, border = 0) …
Be careful on where you download the antivirus or antispyware. This is because some setup files in untrusted places can be embeded with malicious software. Also running many antivirus and antisyware at same time causes conflicting. So before using one (If you do testing) disable one and use the other.
Is problem still persisting??
I have Ubuntu with HP Laptop with No Problem. Couldn't that be more hardware than software?
Me too. It costed me to download and install that big SP1 and I plan to turn of because it won't even download. I don't know what is wrong with Vista Home Premium in my Laptop??
# execute SQL select statement
cursor.execute("SELECT * FROM User")
From what I know I think it was supposed to be this way
FROM user SELECT *
make another function to strip spaces
And then the storm will end!
Paul have made it clear
have you tried google? And what do you mean fly code? I'll have to check when I get time
In Wx demo, there is a nice example. I'm trying to do the same. It is new widget. Which version of wxpy are you using??
what does join do? does it replace only commas or any other joining charcter?
I'll dig py docs but forum sometimes is best place for answers
Welcome to daniweb!
Can you wrap your codes in tags please. Also define what FASTA FORMAT is. We are from different background, and not all of us knows Bios and Logos!
can you put your code in tags? I have failed to reconstruct exactly what you wrote and I gave up. Until I see your code, I will try figure out!
Thanks
Steve
Free IDE? Many
Wing IDE 101 - but reduced features
Drpython - No debugging
PyScripter
Netbeans with Nbpython
Eclipse with pydev plugin
Eric (Make sure you take care of Qt licence)............etc