Getting an Error TypeError: unsupported operand type(s) for -=: 'Retry' and 'int'

2022-08-17 Thread Coder
 sudo pip install  pyro4
Collecting pyro4
  Downloading 
https://files.pythonhosted.org/packages/70/e3/8c4e0d24b46fbf02e6b2dc2da5d18f0c73cfd343a1fb01ae64c788c20e56/Pyro4-4.82-py2.py3-none-any.whl
 (89kB)
100% || 92kB 7.3MB/s 
Collecting selectors34; python_version < "3.4" (from pyro4)
  Downloading 
https://files.pythonhosted.org/packages/13/25/4f4fa70ab23ad6263fe59cedf9dcd3ef71aa7f99c556c5e4c6435829e22d/selectors34-1.2-py2.py3-none-any.whl
Collecting serpent<1.30,>=1.27; python_version < "3.2" (from pyro4)
Exception:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 209, in main
status = self.run(options, args)
  File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 328, in 
run
wb.build(autobuilding=True)
  File "/usr/lib/python2.7/dist-packages/pip/wheel.py", line 748, in build
self.requirement_set.prepare_files(self.finder)
  File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 360, in 
prepare_files
ignore_dependencies=self.ignore_dependencies))
  File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 512, in 
_prepare_file
finder, self.upgrade, require_hashes)
  File "/usr/lib/python2.7/dist-packages/pip/req/req_install.py", line 273, in 
populate_link
self.link = finder.find_requirement(self, upgrade)
  File "/usr/lib/python2.7/dist-packages/pip/index.py", line 442, in 
find_requirement
all_candidates = self.find_all_candidates(req.name)
  File "/usr/lib/python2.7/dist-packages/pip/index.py", line 400, in 
find_all_candidates
for page in self._get_pages(url_locations, project_name):
  File "/usr/lib/python2.7/dist-packages/pip/index.py", line 545, in _get_pages
page = self._get_page(location)
  File "/usr/lib/python2.7/dist-packages/pip/index.py", line 648, in _get_page
return HTMLPage.get_page(link, session=self.session)
  File "/usr/lib/python2.7/dist-packages/pip/index.py", line 757, in get_page
"Cache-Control": "max-age=600",
  File 
"/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/sessions.py",
 line 492, in get
return self.request('GET', url, **kwargs)
  File "/usr/lib/python2.7/dist-packages/pip/download.py", line 378, in request
return super(PipSession, self).request(method, url, *args, **kwargs)
  File 
"/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/sessions.py",
 line 480, in request
resp = self.send(prep, **send_kwargs)
  File 
"/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/sessions.py",
 line 588, in send
r = adapter.send(request, **kwargs)
  File 
"/usr/share/python-wheels/CacheControl-0.11.5-py2.py3-none-any.whl/cachecontrol/adapter.py",
 line 46, in send
resp = super(CacheControlAdapter, self).send(request, **kw)
  File 
"/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/adapters.py",
 line 376, in send
timeout=timeout
  File 
"/usr/share/python-wheels/urllib3-1.13.1-py2.py3-none-any.whl/urllib3/connectionpool.py",
 line 610, in urlopen
_stacktrace=sys.exc_info()[2])
  File 
"/usr/share/python-wheels/urllib3-1.13.1-py2.py3-none-any.whl/urllib3/util/retry.py",
 line 238, in increment
total -= 1
TypeError: unsupported operand type(s) for -=: 'Retry' and 'int'
You are using pip version 8.1.1, however version 22.2.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.



I tried removing pip and reinstalling it again.

still facing same issue.
-- 
https://mail.python.org/mailman/listinfo/python-list


How filecmp walk into subdirectories?

2011-11-01 Thread Muddy Coder
Hi Folks,


I tried to compare two directories, each with hundreds of files in
multiple level subdirectories, to find out the different files. I used
filecmp module to the job as:


comp=filecmp.dircmp(adir, bdir)
comp.report()

It worked, and printed out the identical and different files. However,
it did not go through the directory trees, just did the job in the
first level. I wonder somebody can help? Thanks in advance!


Cosmo
-- 
http://mail.python.org/mailman/listinfo/python-list


How to move scrollbar by code?

2011-12-09 Thread Muddy Coder
Hi Folks,

I am trying to make a listbox that will contain a looong data list,
sorted, so I will be able to pre-select a data line by coding. I have
done it. Say my listbox contains 1000 data lines, and my program has
figured out the data line 321 is needed, so just put the cursor on
data line 321. However, my scrollbar is still seating on the top, so I
just can view the data line from line 0 to 30 or 40, since I can't see
the desired data line 321.  I still need to manually pull the
scrollbar down to display the data line 321. What I want to do is to
grab the adjacent data lines, say from line 300 to 340, and display
this lines, while my cursor seating in the middle. I consulted the
Python Docs, but did not find such details. Can somebody give an idea?
Thanks!


Cosmo
-- 
http://mail.python.org/mailman/listinfo/python-list


What is this widget?

2011-12-14 Thread Muddy Coder
Hi Folks,

I am trying to write letters on a photo that is opened in a canvas. So
I think I must need a widget to contain the letters I will type in. I
tried to use a Label, it worked. But, a Label covered part of the
photo underneath, so I can't use it. I saw some software did such a
thing nicely: a box popped on a photo, with dotted lines as borders,
expandable. When such a box was re-sized with a mouse, the font size
in the box also got changed. The box has no background color, so it
does not cover a rectangle area on the photo. I need such a widget,
but I don't know what is this one. I tried Text, Label, but they all
come with Window-like stuff, so they cover some photo content. Can
somebody points me a direction? Thanks!


Cosmo
-- 
http://mail.python.org/mailman/listinfo/python-list


What is this widget? -- again

2011-12-14 Thread Muddy Coder
Hi Folks,

Sorry for the unclear question in last post. Well, I am using Tkinter
to do GUI, and I just don't know what kind of widget can let me do
annotation on an image being displayed. An example is the Paint of
Windows: a dotted line box appearing on a image to hold a typed in
text. I just can't figure out what widget in Tkinter is equivalent to
that dotted line box. Please help, thanks again!


Cosmo
-- 
http://mail.python.org/mailman/listinfo/python-list


How to use a color value returned by colorChooser?

2011-12-14 Thread Muddy Coder
Hi Folks,

This should be a simple question, but I just can't get an answer from
Phython Docs. You see, when we created a widget, and need to tweak the
color, we just simply configure it, such as:

abutton = Button(root, text='Foo')
abutton.config(fg='blue')

so we can make the Button color in blue. However, when I choose a
color by a color Dialog, askcolor, and then I will get a color value
as:   (0, 0, 255) . So, I want to use this returned color value to
configure my existing widgets, with widget.config() syntax. The Python
interpreter does not take it. Therefore, I think I must need to covert
this returned color value into a symbolic name, such as 'blue', 'red'
and so on, then the widget.config() syntax can be used. How can I
convert this color value? Please help, thanks folks!

Cosmo
-- 
http://mail.python.org/mailman/listinfo/python-list


Why widgets become 'NoneType'?

2011-12-21 Thread Muddy Coder
Hi Folks,

I was driven nuts by this thing: widgets lost their attributes, then I
can't configure them. Please take a look at the codes below:

from Tkinter import *
canvas = Canvas(width=300, height=400, bg='white')
canvas.pack(expand=NO, fill=BOTH)
pic = PhotoImage(file=img)
canvas.create_image(0, 0, image=pic)
al = PhotoImage(file='a.gif')

lbl = Label(canvas, text=x, fg='red').pack(side=LEFT)

canvas.create_text(40,20, text='Howdy')

the last line of code got error message, says canvas object has no
attribute of config.  The same problem happened again, the code is
below:

def make_labels(win, astr):

labels = []
for i in range(len(astr)):
lbl = Label(win, text=astr[i]).pack(side=LEFT )
labels.append(lbl)
return tuple(labels)
def config_labels(atuple, func):
for lbl in atuple:
lbl.config('%s') % func

root = Tk()
lbls = make_labels(root, 'foobar')
config_labels(lbls, "fg='red'")

The config for Label was picked up: No attributes of config. I tried
to print type(lbls), and found Python interpreter reported as
'NoneType'. I also tried to print out dir(lbls), fount there was no
attributes I familiar with such as config and such. What is wrong with
them? Both of the codes above WORKED, since I saw my widgets displayed
them as I wanted, but I just can't configure them as I usually did.
Can somebody help me out? I never experience such a weird thing.
Thanks!

Cosmo
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: automatically grading small programming assignments

2006-12-14 Thread commander . coder

[EMAIL PROTECTED] wrote:
Then on your PC you can
> run a script that loads each of such programs, and runs a good series
> of tests, to test their quality...
What happens if someone-- perhaps not even someone in the class-- does
some version of os.system('rm -Rf /') ?

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: automatically grading small programming assignments

2006-12-14 Thread commander . coder

[EMAIL PROTECTED] wrote:
Then on your PC you can
> run a script that loads each of such programs, and runs a good series
> of tests, to test their quality...
What happens if someone-- perhaps not even someone in the class-- does
some version of os.system('rm -Rf /') ?

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How a script can know if it has been called with the -i command line option?

2006-12-21 Thread commander . coder

Michele Simionato wrote:
> The subject says it all, I would like a script to act differently when
> called as
> $ python script.py and when called as $ python -i script.py. I looked
> at the sys module
> but I don't see a way to retrieve the command line flags, where should
> I look?
In the optparse module.

Jim

-- 
http://mail.python.org/mailman/listinfo/python-list


Can webbrowser module get source code?

2009-01-24 Thread Muddy Coder
Hi All,

I played the demo of webbrowser module, with the code below:

import webbrowser
url = 'https://login.yahoo.com'
webbrowser.open_new_tab(url)

when I ran the code, it popped out a webpage nicely. I want to go
further: to get the source code of the webpage being displayed. Is it
possible to do it? I tried webbrow.get() but didn't work. Somebody can
help? Thanks!


Muddy Coder
--
http://mail.python.org/mailman/listinfo/python-list


Re: Is this pythonic?

2009-01-27 Thread Baby Coder
On 18 déc 2008, 13:51, Jason Scheirer 
wrote:

> I'd say it's fine but breaking up the statement once or twice is a
> good idea just because if one of the function calls in this nested
> thing throws an exception, a smaller statement with fewer calls makes
> for a far more readable traceback. And I hope that this whole
> statement all lives inside of a method in the same x class, or is a
> higher-level class that makes use of this behavior? If not, you may
> want to consider doing so.
>
> class X(object):
>   @property
>   def todays_filepattern(self):
>       return self.match_filename(
>               self.determine_filename_pattern(
>                    datetime.datetime.now()))
>   def validate_todays_files(self):
>      return self.validate_output(self.find_text
> (self.todays_filepattern))

Thanks for this lesson in application design. Just what I was looking
for.
--
http://mail.python.org/mailman/listinfo/python-list


How to execute a hyperlink?

2009-01-27 Thread Muddy Coder
Hi Folks,

Module os provides a means of running shell commands, such as:

import os
os.system('dir .')

will execute command dir

I think a hyperlink should also be executed. I tried:

os.system('http://somedomain.com/foo.cgi?name=foo&passwd=bar')

but I got kicked out by the Python interpreter. I wonder somebody
knows the syntax of triggering a hyperlink? Thanks in advance!


Muddy Coder
--
http://mail.python.org/mailman/listinfo/python-list


Results of executing hyperlink in script

2009-01-28 Thread Muddy Coder
Hi Folks,

My previous post got a many helps from the people, and I tested what
they suggested. Since this topic maybe needed in future, so I drop
these lines below to help the future programmers. The methods worked
as below:

1. This method was suggested by Cameron Laird:

  os.system("start %s" % URL)

It works. But, if the URL contains character &, it will fail. For
example, if URL has only one field, such as: 
http://www.mydomain.com/ascript.cgi?user=muddy
this method works well. But, if there more than one field need to be
input, such as http://www.mydomain.com/ascript.cgi/user=muddy&password=foo,
the field password failed to reach server, and the CGI script
complained.

2. The best way is to use urllib2, suggested by Ron Barak, my code is
below:

import urllib2
source = urllib2.urlopen(URL).read()
print source

It successfully triggered CGI script, and also got feedback from
server. It works very well!

My thanks go to all the helpers!

Muddy Coder

--
http://mail.python.org/mailman/listinfo/python-list


How to trigger a smart link?

2009-02-04 Thread Muddy Coder
Hi All,

Using urllib2 can trigger CGI script in server side. However, I
encountered a problem of the so-called smart link. When a fairly large
site, the server needs to track the identifier of each request from
client, so it generated an ugly escape string attached on url. It
seems that I must get this ugly escape string first then I can can
fill the string into my url, and the CGI script on server side can be
triggered. For example,

http://whatever.com/submitreal.cgi?fp=3xD0TuGMp7C7gP1TRD

displays a submit form. If I just copy

http://whatever.com/submitreal.cgi

to url address, without the escape string ?fp=3xD0TuGMp7C7gP1TRD, the
browser will report error of 404

I found Python has a module of escape, but I don't know how to use
this module to solve the problem above. Or, I just wonder does urllib2
has such a method to handle smart link? Thanks!


Moddy Coder
--
http://mail.python.org/mailman/listinfo/python-list


urllib2: problem of handling space in parameter

2009-02-07 Thread Muddy Coder
Hi Folks,

I encrountered a problem of using urllib2: the space handling. Look at
the code below:

import urllib2
url = r'http://somedomain.com/a.cgi?name=muddy coder&password=foobar
cgi_back = urllib2.urlopen(url).read()

In this cgi_back, I saw field password worked fine, but field name
not, only muddy was picked up by CGI. So, I had to cover the space, by
using syntax name=muddy-coder, it went through. So, I presume urllib2
may have an approach of handling white space in this regard. Can
anybody help? Thanks!

Muddy Coder
--
http://mail.python.org/mailman/listinfo/python-list


Can urllib check path exists on server?

2009-02-10 Thread Muddy Coder
Hi Folks,

urllib bridges up a client to a server, it works fine. I wonder: is
there a method that can check the existence of a file in the server
side? We can check such an existence on local filesystem by using
os.path.exists(), can I do such a check on server? For example,
http://somedomain.com/foo/bar.jpg is residing in a hosting server, can
I use urllib to check if bar.jpg file existing or not? Thanks!

Muddy Coder
--
http://mail.python.org/mailman/listinfo/python-list


How to get a return from Button?

2009-02-10 Thread Muddy Coder
Hi Folks,

I want to use a Button to trigger askopenfilename() dialog, then I can
select a file. My short code is below:


def select_file():
filenam = askopenfilename(title='Get the file:')
   return filenam

root = Tk()
Button(root, text='Select a file', command=select_file).pack()
root.mainloop()

My goal is to get the path of filenam, but the function select_file()
has nowhere to return what it selected. Can anybody help me out? I
consulted the book of Programming Python, but found no demo in this
regard. If the function has no return, command=blabla will work
nicely. I am lost in the scope.

Thanks!


Muddy Coder
--
http://mail.python.org/mailman/listinfo/python-list


Can I 'LOOK' through urllib?

2009-02-11 Thread Muddy Coder
Hi Folks,

I feel good after played urllib with fun!

Now I want to LOOK to server through urllib. I read the urllib docs,
but I did not find such a function. For example, if there are many
files located in http://www.somedomain.com/data_folder, but I don't
know what the filenames are residing in the data_folder. I wish urllib
would have a function to let me do it, as well as I do 'dir' in DOS,
'ls' on unix/linux. Somebody write me a demo? Thanks!


Muddy Coder
--
http://mail.python.org/mailman/listinfo/python-list


Help: makefile in Windows

2009-02-12 Thread Muddy Coder
Hi Folks,

I am learning Extending Python, by testing the demo script of
Programming Python. In the book, a makefile for Linux is there, but I
am using Windows currently. I wish somebody would help me to get a
makefile for Windows, my makefile.linux is as below:

PYDIR= c:\Python25
PY = $(PYDIR)

hello.so: hello.c
gcc hello.c -g -I$(PY)/include -I$(PY) -fpic -share -o
hello.so
clean:
   rm hello.so core



Thanks a lot!


Muddy Colder
--
http://mail.python.org/mailman/listinfo/python-list


How to parse form in client side?

2009-02-26 Thread Muddy Coder
Hi Folks,

cgi module can easily acquire the all fields of data input from client
side, through a form. Then, a simple line of code:

form_dict = cgi.FieldStorage()

grabs all data into a dictionary form_dict. The rest becomes a piece
of cake by querying the form_dict. Nice!

However, it is done in the server side. Now I want to do the same in
the client side. first of all, I get the source code of a HTML form by
using urllib, from server, with code below:

html_source = urllib.urlopen(URL).read()

Then, I need to parse this html_source file, at client side. Is there
a module to handle this? Can somebody help? Thanks!


Muddy Coder
--
http://mail.python.org/mailman/listinfo/python-list


Bug report: ClientForm

2009-02-28 Thread Muddy Coder
Hi Folks,

As directed, I got ClientForm and played with it. It is cool! However,
I also found a bug:

When it parses a form, if the VALUE of a field has not space, it works
very well. For example, if a dropdown list, there many options, such
as:

 

the value foo will be picked up for sure. But, if there is a space:

 .

The *bar* will be missed out. I wish this bug can be fixed in near
future.

By the way, can somebody helps me on setting parameter of uploading a
file. In ClientForm, if I need to upload a text file, I can do it by:

form.add_file(..., "text/plain")

What about a picture file? What is the counterpart of 'text/plain"?
Thanks!

Muddy Coder
--
http://mail.python.org/mailman/listinfo/python-list


Is it possible to grab hidden code in ClientForm?

2009-03-01 Thread Muddy Coder
Hi Folks,

Nowadays some websites let users to fill in some so-called
verification code, and the tricky thing is that the CODE is delivered
from server with an image. For example:

  Refresh Image

When click Refresh Image, the CODE on the image changes. I wonder:
does the server really send a new image over to browser, or just send
a hidden code over? Is it possible to parse out such hidden code?

The other example is:




I did a few REFRESH on browser, and noticed the CODE changed. But,
when I viewed the HTML source code, the value "ahZsBmwyLGuf" remained
the same. What is the trick around here? That is why I am wondering
whether the server really keeps sending new images over, or just
sending new hidden codes over. If the trick is just keep sending
hidden codes over, there might be a chance of capturing the codes. Can
somebody help me out? Thanks a lot!


Muddy Coder





--
http://mail.python.org/mailman/listinfo/python-list


Can CleintForm work with webbrowser?

2009-03-01 Thread Muddy Coder
Hi Folks,

ClientForm is cool at grabbing and parsing stuff from server, I like
it. After the stuff parsed, and even filled values for the Controls, I
popped up an idea of displaying what I had done with webbrowser. Look
at the code:

import ClientForm
import urllib2
import webbrowser

request = urllib2.Request(url)
response = urllib2.urlopen(request)
forms = ClientForm.ParseResponse(response, backwards_compat=False)
...parsing and filling forms

# now I want to display the forms I modified, with webbrowser
webbrowser.open_new_tab (???)

??? is supposed to be a url. But this moment I want to display the
form I filled. Obviously webbrowser takes url as argument rather than
a form.  Is there other options to do this? Somebody can help? Thanks!


Muddy Coder
--
http://mail.python.org/mailman/listinfo/python-list


Can Python do shopping cart?

2009-03-05 Thread Muddy Coder
Hi Folks,

I know PHP can do shopping cart, such as Zen Cart. I wonder can Python
do such a thing? Thanks!



Muddy Coder
--
http://mail.python.org/mailman/listinfo/python-list


How to import Python files in the other directories?

2009-03-05 Thread Muddy Coder
Hi Folks,

If I have a python file foo.py in the current directory, I can simply
import it in the way below:

import foo

when a project keeps grow, more and more Python files are created, and
they are also needed to put into different directories. Then, a
problem comes: how to import the Python files residing in the other
directories? Somebody helps me out? Thanks!


Muddy Coder
--
http://mail.python.org/mailman/listinfo/python-list


How to define a db file for sqlite?

2009-03-07 Thread Muddy Coder
Hi Folks,

I just downloaded and installed pysqlite, and I can import sqlite3
smoothly. Then, I need to connect sqlite by syntax:

>>>conn = sqlite3.connect('adirectory/db')

I wish the data will be stored into directory ---> adirectory, with a
file named in db. But I got kicked out with an error message as:

Unable to open database file

I wonder: does pysqlite open a database file db for me? Or, do I need
to create an empty file inside adirectory with my text editor? Anyway,
somebody please help me out here. After I can connect it, the rest
will be easy to go, thanks!

Muddy coder
--
http://mail.python.org/mailman/listinfo/python-list


Does Python have certificate?

2009-03-23 Thread Muddy Coder
Hi Folks,

I wonder that does Python have certificate? You see, java, .NET, PHP,
and so on, they have certificates for developers to get. Python is
quite popular nowadays, I wonder is there such a thing? If so, I
certainly want to get one. I searched, and


Muddy Coder

--
http://mail.python.org/mailman/listinfo/python-list


SWIG: Window syntax help

2009-03-26 Thread Muddy Coder
Hi Folks,

I am learning SWIG, with a doggy C file test.c. I have made test.i,
the interface file, then I ran:

C:>swig -python test.i   ---> smooth
C:>cl -c test.c test_wrap.c -IC:\Python25\include  > nice,
test.obj, test_wrap.obj, test.py files were created

But the final step I got error message by running this:
C:>cl -shared test.obj test_wrap.obj -o test.dll

It did not take -shared  and -o

I tried to follow the example of the DOCS, and modified the syntax of
unix. Can anybody help me to get a right syntax for Windows? Thanks!

Muddy Coder
--
http://mail.python.org/mailman/listinfo/python-list


How to access object created in Main?

2009-03-29 Thread Muddy Coder
Hi Folks,

I need to update the text field of a Label created in Main, but can't
find a way to do it. Please take a look at my code:

from Tkinter import *

def makemenu(r)
   amenu = Menu(r)
   amenu.add_command(., command=update_label)

def update_label():
how to access mesg created in __main__ ?

if __name__ == '__main__':
root = Tk()
mesg = Label(root, text='foo\nbar\nfoo')
mesg.pack(expand=YES, fill=BOTH)
root.mainloop()

What I need to do is simple: when Menu (amenu) is clicked, it should
execute update_label function that is expected to update the text of
Label mesg in MAIN, with a syntax like: mesg.config(text='new text')
What I don't know is the path of accessing this object mesg. I tried
root.mesg, no good. I am confused here: since mesg is created on root
as its master, why root.mesg is not its path? Can somebody help me
out? Thanks a lot!

Muddy Coder
--
http://mail.python.org/mailman/listinfo/python-list


Help for Toplevel

2009-04-01 Thread Muddy Coder
Hi Folks,

I have a problem of handling Toplevel window. Basically, I wrote a
listbox viewer with scrollbars, and saved in file listbo.py. Then in
my main GUI window, with menu, I need to launch the listbox viewer, in
a new window. Obviously, a Toplevel window is needed. But, I failed at
passing parameters over to Toplevel window. Please take a look at my
code:

Listbox viewer:
class ScrolledList(Frame):
def __init__(self, options, parent=None):
Frame.__init__(self, parent)
self.pack(expand=YES, fill=BOTH)
self.makeWidgets(options)

In my main GUI:
from XXX import ScrolledList
class Foo:
 def __init__(self):
 
 def call_listbox(self, params):
   new = Toplevel()
   alist = ['foor','bar']
   ScrolledList(new,alist)

With the code above, the widgets did not show on the Toplevel window,
and the data list ['foo','bar'] did not show up either. Can somebody
help me on it? Thanks a lot!

Muddy Coder
--
http://mail.python.org/mailman/listinfo/python-list


How can I change size of GUI?

2009-04-06 Thread Muddy Coder
Hi Folks,

I copied code from book:

class ScrolledText(Frame):
def __init__(self, parent=None, text='', file=None):
Frame.__init__(self, parent)
self.pack(expand=YES, fill=BOTH)
self.makeWidgets()
self.settext(text, file)
def makeWidgets(self):
sbar = Scrollbar(self)
text = Text(self, relief=SUNKEN, width=120)
sbar.config(command=text.yview)
text.config(yscrollcommand=sbar.set)
sbar.pack(side=RIGHT, fill=Y)
text.pack(side=LEFT, expand=YES, fill=BOTH)
self.text = text

It works, of course. But, the GUI is small, and I want to enlarge it.
I tried to add in options of width=120 for Text(), but it did not
work. Can somebody drop me a couple of lines for help? Thanks!

Muddy Coder
--
http://mail.python.org/mailman/listinfo/python-list


How to query object of GUI?

2009-04-14 Thread Muddy Coder
Hi Folks,

I need to query the ID of GUI, in Tkinter, but don't know how to do
it. This is my code:

calss MyGUI:
   
   def make_menu(self):
  top = Menu(self)
  menObj = Menu(top)
  labels = read_from_database()
  for lab in labels:
 menObj.add_command(label=lab, command=self.do_menu)
   def do_menu(self):
  # here I need query which menu item was clicked

For GUI Entry, there is a resource name textvariable, so I can use
textvariable to distinguish one Entry from the others. But, I can't
find such a resource name for Menu. I also noticed label is an
identifier, but I have no idea how to get it. Can somebody help me
out? Thanks in advance!


Muddy Coder
--
http://mail.python.org/mailman/listinfo/python-list


Where to find options for add_command?

2009-04-15 Thread Muddy Coder
Hi Folks,

When I make Menu, and add in menu items, by using add_command, such
as:

menuObj.add_command(label='Open File', command=self.open_file)

It works. But, I want to make the GUI looking better. So, I want to
change color, font, size, background, for the label of Open File. I
got clobbered. I tried relief, fg, color, no one worked. Can somebody
points me a website to visit, to check out what options available for
add_command? Thanks!


Muddy Coder
--
http://mail.python.org/mailman/listinfo/python-list


RE: Qt with PyDev

2011-01-05 Thread Rohit Coder

Seen both, but do I need to install the binaries or add a link in Pydev to 
PySide source-code?

Date: Tue, 4 Jan 2011 07:09:53 -0800
From: gher...@islandtraining.com
To: python-list@python.org
Subject: Re: Qt with PyDev



  



  
  
On 01/04/2011 12:00 AM, RP Khare wrote:

  
  I installed Aptana PyDev plugin to Aptana Studio 3 Beta. I want to
  write my first GUI application using Python and I want to use Qt
  for it. How to integrate Qt into PyDev, or is there any other
  alternative IDE to work with Qt?
  
element

  

  Font


  font-family
  


  font-size
  


  font-style
  


  font-variant
  


  font-weight
  


  letter-spacing
  


  line-height
  


  text-decoration
  


  text-align
  


  text-indent
  


  text-transform
  


  white-space
  


  word-spacing
  


  color
  


  Background


  bg-attachment
  


  bg-color
  


  bg-image
  


  bg-position
  


  bg-repeat
  


  Box


  width
  


  height
  


  border-top
  


  border-right
  


  border-bottom
  


  border-left
  


  margin
  


  padding
  


  max-height
  


  min-height
  


  max-width
  


  min-width
  


  outline-color
  


  outline-style
  


  outline-width
  


  Positioning


  position
  


  top
  


  bottom
  


  right
  


  left
  


  float
  


  display
  


  clear
  


  z-index
  


  List


  list-style-image
  


  list-style-type
  


  list-style-position
  


  Table


  vertical-align
  


  border-collapse
  


  border-spacing
  


  caption-side
  


  empty-cells
  


  table-layout
  


  Effects


  text-shadow
  


  -webkit-box-shadow
  


  border-radius
  


  Other


  overflow
  


  cursor
  


  visibility
  

  

  
  

  
  ...
  Rohit



See either of these packages:

  PyQt: http://qt.nokia.com/products/

  PySide: http://www.p

Attaching C++ libraries to Python app.

2011-01-05 Thread Rohit Coder

Is it possible to use C++ libraries within a Python application? I am planning 
to write an encryption program and want to use GnuPG C++ 
libraries.elementFontfont-familyfont-sizefont-stylefont-variantfont-weightletter-spacingline-heighttext-decorationtext-aligntext-indenttext-transformwhite-spaceword-spacingcolorBackgroundbg-attachmentbg-colorbg-imagebg-positionbg-repeatBoxwidthheightborder-topborder-rightborder-bottomborder-leftmarginpaddingmax-heightmin-heightmax-widthmin-widthoutline-coloroutline-styleoutline-widthPositioningpositiontopbottomrightleftfloatdisplayclearz-indexListlist-style-imagelist-style-typelist-style-positionTablevertical-alignborder-collapseborder-spacingcaption-sideempty-cellstable-layoutEffectstext-shadow-webkit-box-shadowborder-radiusOtheroverflowcursorvisibility
...Rohit.   
  -- 
http://mail.python.org/mailman/listinfo/python-list


RE: Attaching C++ libraries to Python app.

2011-01-05 Thread Rohit Coder

I am just asking. In future I may need to import any C++ library, not a Crypto, 
but some other. Is it possible?

> Date: Wed, 5 Jan 2011 22:44:15 +0100
> Subject: Re: Attaching C++ libraries to Python app.
> From: stefan.sonnenb...@pythonmeister.com
> To: passionate_program...@hotmail.com
> CC: python-list@python.org
> 
> You don't need to reinvent the wheel:
> 
> http://www.dlitz.net/software/pycrypto/
> 
> Am Mi, 5.01.2011, 22:21 schrieb Rohit Coder:
> >
> > Is it possible to use C++ libraries within a Python application? I am
> > planning to write an encryption program and want to use GnuPG C++
> > libraries.elementFontfont-familyfont-sizefont-stylefont-variantfont-weightletter-spacingline-heighttext-decorationtext-aligntext-indenttext-transformwhite-spaceword-spacingcolorBackgroundbg-attachmentbg-colorbg-imagebg-positionbg-repeatBoxwidthheightborder-topborder-rightborder-bottomborder-leftmarginpaddingmax-heightmin-heightmax-widthmin-widthoutline-coloroutline-styleoutline-widthPositioningpositiontopbottomrightleftfloatdisplayclearz-indexListlist-style-imagelist-style-typelist-style-positionTablevertical-alignborder-collapseborder-spacingcaption-sideempty-cellstable-layoutEffectstext-shadow-webkit-box-shadowborder-radiusOtheroverflowcursorvisibility
> > ...Rohit.   
> >   --
> > http://mail.python.org/mailman/listinfo/python-list
> >
> 
> 
> -- 
> MfG,
> 
> Stefan Sonnenberg-Carstens
> 
> IT Architect
elementFontfont-familyfont-sizefont-stylefont-variantfont-weightletter-spacingline-heighttext-decorationtext-aligntext-indenttext-transformwhite-spaceword-spacingcolorBackgroundbg-attachmentbg-colorbg-imagebg-positionbg-repeatBoxwidthheightborder-topborder-rightborder-bottomborder-leftmarginpaddingmax-heightmin-heightmax-widthmin-widthoutline-coloroutline-styleoutline-widthPositioningpositiontopbottomrightleftfloatdisplayclearz-indexListlist-style-imagelist-style-typelist-style-positionTablevertical-alignborder-collapseborder-spacingcaption-sideempty-cellstable-layoutEffectstext-shadow-webkit-box-shadowborder-radiusOtheroverflowcursorvisibility
  -- 
http://mail.python.org/mailman/listinfo/python-list


How suitable is Python to write system utilities?

2011-01-06 Thread Rohit Coder

Is Python suitable to write low-level system utilities like Defrag, Malware 
Removal Tools and Drivers?
  -- 
http://mail.python.org/mailman/listinfo/python-list


Working with PyQt and Pydev

2011-01-06 Thread Rohit Coder

I installed the PyDev plugin into Aptana Stdui 3 Beta. Someone suggested me to 
use PyQt for Python GUI app, and so I downloaded and installed PyQt. But when I 
open Aptana Studio, I could see a new menu added with the name "PyDev", but 
there is nothing for PyQt.
In the Windows Start Meny item list, I could see a folder named PyQt and when I 
open it, there are few tools like Designer.
When Designer is run, it opens Qt IDE for designing Forms like Visual Studio 
and the files have the extension .ui.I want to know how to integrate PyQt and 
PyDev. Do I need to use them separately by adding the .ui files to PyDev and 
then adding Python core code for functionality?
...Rohit.elementFontfont-familyfont-sizefont-stylefont-variantfont-weightletter-spacingline-heighttext-decorationtext-aligntext-indenttext-transformwhite-spaceword-spacingcolorBackgroundbg-attachmentbg-colorbg-imagebg-positionbg-repeatBoxwidthheightborder-topborder-rightborder-bottomborder-leftmarginpaddingmax-heightmin-heightmax-widthmin-widthoutline-coloroutline-styleoutline-widthPositioningpositiontopbottomrightleftfloatdisplayclearz-indexListlist-style-imagelist-style-typelist-style-positionTablevertical-alignborder-collapseborder-spacingcaption-sideempty-cellstable-layoutEffectstext-shadow-webkit-box-shadowborder-radiusOtheroverflowcursorvisibility
 -- 
http://mail.python.org/mailman/listinfo/python-list


Create a class to position a window on the screen.

2011-01-08 Thread Rohit Coder

Hi,elementFontfont-familyfont-sizefont-stylefont-variantfont-weightletter-spacingline-heighttext-decorationtext-aligntext-indenttext-transformwhite-spaceword-spacingcolorBackgroundbg-attachmentbg-colorbg-imagebg-positionbg-repeatBoxwidthheightborder-topborder-rightborder-bottomborder-leftmarginpaddingmax-heightmin-heightmax-widthmin-widthoutline-coloroutline-styleoutline-widthPositioningpositiontopbottomrightleftfloatdisplayclearz-indexListlist-style-imagelist-style-typelist-style-positionTablevertical-alignborder-collapseborder-spacingcaption-sideempty-cellstable-layoutEffectstext-shadow-webkit-box-shadowborder-radiusOtheroverflowcursorvisibility
I am new to Python and this is my fist Python class. I am using PyQt4 framework 
on Windows 7.
I don't know whether the code below is correctly written or not. I want to 
modify it further as:
 1. In the arguments, I want to pass the name of another opened Window (.py) on 
the screen. 2. I want to pass the x-coord., y-coord. and the name of the window 
to position on the screen.
How to modify the code to fulfill these requirements?
**Attempted Code**
class PositionWindow:def __init__(self, xCoord, yCoord, windowName, 
parent = None):  self.x = xCoord  self.y = yCoord  
self.wName = windowName;def center(self):screen 
= QtGui.QDesktopWidget().screenGeometry()size = self.geometry() 
   self.move((screen.width()-size.width())/2, 
(screen.height()-size.height())/2)
...Rohit.
  -- 
http://mail.python.org/mailman/listinfo/python-list


Centering a window

2011-01-10 Thread Rohit Coder

I am using PyQt4 for GUI apps.
I created a class that contains a function to center any window (Form) whose 
name is passed to this class. I have two questions:
How to modify the below given code to center the window whose name we passed as 
an argument.How to pass window name to this class from another file that 
imports this class?
= CODE BLOCK STARTS HERE ===from PyQt4 import QtGui
class PositionWindow:def __init__(self, xCoord, yCoord, windowName, parent 
= None):  self.x = xCoord  self.y = yCoord  self.wName = 
windowName;def center(self):screen = 
QtGui.QDesktopWidget().screenGeometry()size = self.geometry()
self.move((screen.width()-size.width())/2, 
(screen.height()-size.height())/2)= CODE BLOCK ENDS HERE ===
Rohit 
K.elementFontfont-familyfont-sizefont-stylefont-variantfont-weightletter-spacingline-heighttext-decorationtext-aligntext-indenttext-transformwhite-spaceword-spacingcolorBackgroundbg-attachmentbg-colorbg-imagebg-positionbg-repeatBoxwidthheightborder-topborder-rightborder-bottomborder-leftmarginpaddingmax-heightmin-heightmax-widthmin-widthoutline-coloroutline-styleoutline-widthPositioningpositiontopbottomrightleftfloatdisplayclearz-indexListlist-style-imagelist-style-typelist-style-positionTablevertical-alignborder-collapseborder-spacingcaption-sideempty-cellstable-layoutEffectstext-shadow-webkit-box-shadowborder-radiusOtheroverflowcursorvisibility
  -- 
http://mail.python.org/mailman/listinfo/python-list


Hide DOS console for .pyc file

2010-09-10 Thread Muddy Coder
Hi Folks,

For a quick testing purpose, I deliver .pyc files to my customer. I
don't want the black DOS console appearing behind my GUI, but I have
no idea how to do it. Somebody can help? Thanks!


Cosmo
-- 
http://mail.python.org/mailman/listinfo/python-list