473,406 Members | 2,705 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

rlcompleter and wxPython, problems ...

hello,

I'm trying to implement autocompletion into my editor.
But I find some weird behavior,
or at least I don't have the faintest idea why this behavior occures,
and even more important how to solve it
In the example below I try to autocomplete " wx.s" , which in my humble
opinion should at least produce "wx.stc" (and some others ).

The completion is done in a procedure, so the "locals" is quite clean.
Before calling the completer, I import the left part of my string to be
completed.
The program below gives indeed "wx.stc" as an option,
but if I leave the second line out, marker "<<<===" ,
I get no results.

Can someone explain this behavior and
maybe even have a solution ?

thanks,
Stef Mientki
import rlcompleter
import wx.stc # <<<===

# ************************************************** *********************
# ************************************************** *********************
def _get_completions ( word ) :
left_part = None
right_part = word
if word.find('.') >= 0 :
word_parts = word.split('.')
left_part = '.'.join ( word_parts [ : -1 ] )
right_part = word_parts [ -1 ]

try :
exec ( 'import ' + left_part )
except :
return None

Completer = rlcompleter.Completer ( locals () )
State = 0
Next = Completer.complete ( word, State )
result = []
while Next :
result.append ( Next )
State += 1
Next = Completer.complete ( word, State )

result = ' '.join ( result )
return result
# ************************************************** *********************
# ************************************************** *********************
# ************************************************** *********************
if __name__ == "__main__":

word = 'wx.s'
completions = _get_completions ( word )
print completions
# ************************************************** *****

Sep 28 '08 #1
0 783

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: SeeBelow | last post by:
Do many people think that wxPython should replace Tkinter? Is this likely to happen? I ask because I have just started learning Tkinter, and I wonder if I should abandon it in favor of...
25
by: BJörn Lindqvist | last post by:
See: http://www.wxpython.org/quotes.php. especially: "wxPython is the best and most mature cross-platform GUI toolkit, given a number of constraints. The only reason wxPython isn't the standard...
3
by: michele.simionato | last post by:
This a case where the documentation is lacking. The standard library documentation (http://www.python.org/dev/doc/devel/lib/module-rlcompleter.html) gives this example try: import readline...
1
by: James Stroud | last post by:
Hello All, I will soon have an excuse to install a new operating system on my computer. I would like to know exactly what operating system I should have so that I can get wxPython going....
25
by: TPJ | last post by:
GUI's etc: PyGtk on Windows "(...) So if someone develops mainly for X and just wants to make sure that it is not impossible to run on Windows, you can use PyGTK. (...)", July 2nd, 1999 pyGTK...
6
by: Robin Dunn | last post by:
Announcing ---------- The 2.6.3.2 release of wxPython is now available for download at http://wxpython.org/download.php. This is a mostly bug fix release and takes care of several "unfortunate...
0
by: Robin Dunn | last post by:
Announcing ---------- The 2.6.3.2 release of wxPython is now available for download at http://wxpython.org/download.php. This is a mostly bug fix release and takes care of several "unfortunate...
3
by: writeson | last post by:
Hi all, I'm trying to use wxPython from a fairly new installation of Fedora Core 5. I installed wxPython using yum -y install wxPython and that all seemed to work fine. However, when I run...
0
by: Stef Mientki | last post by:
Gabriel Genellina wrote: in what perspective ? the autocompleter is only meant to assist the program writer ;-) I guess I've to study the package. For the moment I'll implement a user editable...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.