Cascading menus with Tk
Hi all, I am new to Tk, or Python GUI programming and I seem to be stuck. I have looked about for help with Tk GUIs, but everything seems so terse or incomplete?? I have been mostly using the "Introduction to Tkinter" by Fredrik Lundh (http://www.pythonware.com/library/tkinter/introduction/index.htm) What I am trying to do is add cascading menus to a Tk menu widget like: File New... ---> Router ---> Firewall Open Exit This seems simple enough, but I can't get it to work...the two "add_cascade" methods (shown below), if used, run an endless loop that is difficult to break: mainWindow = Tk() mainWindow.title("myApp") # create a menu menubar = Menu(mainWindow) mainWindow.config(menu=menubar) filemenu = Menu(menubar) menubar.add_cascade(label="File", menu=filemenu) filemenu.add_command(label="New...") filemenu.add_cascade(label="Router") filemenu.add_cascade(label="Firewall") filemenu.add_command(label="Open...", command = openFileDialog) filemenu.add_separator() filemenu.add_command(label="Exit", command = mainWindow.destroy) helpmenu = Menu(menubar) menubar.add_cascade(label="Help", menu=helpmenu) helpmenu.add_command(label="Online Help") helpmenu.add_command(label="Help on the web") helpmenu.add_separator() helpmenu.add_command(label="About...", command = openAboutBox) Any ideas?? Miki -- http://mail.python.org/mailman/listinfo/python-list
Re: Cascading menus with Tk
Martin Franklin wrote: > michelle wrote: > >> Hi all, >> >> I am new to Tk, or Python GUI programming and I seem to be stuck. I >> have looked about for help with Tk GUIs, but everything seems so terse >> or incomplete?? I have been mostly using the "Introduction to Tkinter" >> by Fredrik Lundh >> (http://www.pythonware.com/library/tkinter/introduction/index.htm) >> >> What I am trying to do is add cascading menus to a Tk menu widget like: >> >> File >> New... >> ---> Router >> ---> Firewall >> Open >> >> Exit >> >> This seems simple enough, but I can't get it to work...the two >> "add_cascade" methods (shown below), if used, run an endless loop that >> is difficult to break: >> >> mainWindow = Tk() >> mainWindow.title("myApp") >> >> # create a menu >> menubar = Menu(mainWindow) >> mainWindow.config(menu=menubar) >> >> filemenu = Menu(menubar) >> menubar.add_cascade(label="File", menu=filemenu) >> filemenu.add_command(label="New...") > > > I think you want these two options to be in a cascading menu like so: > > newmenu = Menu(filemenu) > filemenu.add_cascade(label="New...", menu=newmenu) > > newmenu.add_command(label="Router") > newmenu.add_command(label="Firewall") > > > >> filemenu.add_cascade(label="Router") >> filemenu.add_cascade(label="Firewall") >> filemenu.add_command(label="Open...", command = openFileDialog) >> filemenu.add_separator() >> filemenu.add_command(label="Exit", command = mainWindow.destroy) >> >> helpmenu = Menu(menubar) >> menubar.add_cascade(label="Help", menu=helpmenu) >> helpmenu.add_command(label="Online Help") >> helpmenu.add_command(label="Help on the web") >> helpmenu.add_separator() >> helpmenu.add_command(label="About...", command = openAboutBox) >> >> Any ideas?? >> >> Miki > > > Martin > Thank you, your code worked perfectly Miki -- http://mail.python.org/mailman/listinfo/python-list
Help with Python/ArcPy
Does anyone know of a website or forum where there is help for ArcPY (Python) programmers? ESRI's (GIS) resource center Forums are very busy and my questions go days without an answer. Any suggestions would be great. Thanks!! Michelle Couden TPP-T GIS Cartographer Certified GIS Analyst (512) 486-5136 Fax (512)486-5153 michelle.cou...@txdot.gov<mailto:michelle.cou...@txdot.gov> Mind the road, not your business. [Logo] <>-- http://mail.python.org/mailman/listinfo/python-list
New to Python and understanding problem
Hello *, because I am runing into problems with SOME python based programs, I the this as opportunity to learn python (after ASM, C, BaSH, CP/M, COBOL, JS, PHP and perl). OK, I tried to install "blueman" (Bluetooth Manager) on my Debian 9.2 (Stretch system and discovered a problem: [ c 'blueman-applet' ]-- Traceback (most recent call last): File "./blueman-applet", line 15, in from blueman.Functions import create_logger, create_parser, set_proc_title ImportError: No module named 'blueman' So ist does not find the module and this are the fist 16 lines of the python script: [ '/usr/bin/blueman-applet' ]--- #!/usr/bin/env python3 # coding=utf-8 import sys import os import signal import logging # support running uninstalled _dirname = os.path.abspath(os.path.join(os.path.dirname(__file__), "..")) if 'BLUEMAN_SOURCE' in os.environ: sys.path = [_dirname, os.path.join(_dirname, 'module', '.libs')] + sys.path os.environ["GSETTINGS_SCHEMA_DIR"] = os.path.join(_dirname, "data") from blueman.Functions import create_logger, create_parser, set_proc_title from blueman.main.Applet import BluemanApplet I think, that I have found the error here: sys.path = [_dirname, os.path.join(_dirname, 'module', '.libs')] + sys.path because there is written in [ '/usr/lib/python-3.5/os.py' ]- To get a full path (which begins with top) to a file or directory in dirpath, do os.path.join(dirpath, name). Hence, os.path.join() has only 2 parameters and not 3. The module "blueman" is a subdirectory and the full path is /usr/lib/python-3.5/site-packages/blueman So, how can I correct this problem? And then here is anoter thing which I do not understand becasue I have not found it in the Tutorial: What do the [ ... ] mean or what function is it? Thanks in avance -- Michelle KonzackMiila ITSystems @ TDnet GNU/Linux Developer 00372-54541400 -- https://mail.python.org/mailman/listinfo/python-list
Re: New to Python and understanding problem
Hello Dan, Am 2018-01-29 hackte Dan Stromberg in die Tasten: > I don't see blueman on pypi, so this is probably part of the package > you downloaded, and not something you need to "pip3 install". I have Python 2.7 and 3.5 from the Debian GNU/Linux repository installed I use the Stable (Stretch) version. Installing blueman 2.0.4 (for Python 2.7) ended with a SEGFAULT. Hence I downloaded the sources 2.1~alpha2 from the Experimantal Mirror, comiled and packed it as Backport. Anything went fine, except, if I execute /usr/bin/blueman-applet it does not find the path to blueman which is in /usr/lib/python-3.5/site-packages as subdirectory "bluman". OK, I can hardcode this pig for myself, but I would prefer to make it the correct way and submit a bugreport with patch. > Sometimes this sort of problem surfaces when someone tries to run a > package with a different python than the python the package is > installed into. Do you have more than one python on your machine? 2.7 and 3.5 But since the Python script /usr/bin/blueman-applet has the shebang #!/usr/bin/env python3 The module path should be ok. Thanks in avance -- Michelle KonzackMiila ITSystems @ TDnet GNU/Linux Developer 00372-54541400 -- https://mail.python.org/mailman/listinfo/python-list
Re: Where has the practice of sending screen shots as source code come from?
Am 2018-01-29 hackte John Ladasky in die Tasten: > On Sunday, January 28, 2018 at 7:07:11 AM UTC-8, Steven D'Aprano wrote: >> >> (The day a programmer posts a WAV file of themselves reading their code >> out aloud, is the day I turn my modem off and leave the internet >> forever.) > > What's a... modem? Something I have in my ThinkPad T400 and let me access my Homenetwork without going over the Internet... Hehehe, ThinkPads are the more advanced Laptops... PS/2 Mouse/Keyboard, LPT with Centronics Cabel, ... All with a Dualcore 2,27GHz and 4 GByte of memory (8 GByte upgrade in sight) because of memory hungry Debian Stretch! Oh, I can even exchange my DVD-RW against a second HDD on the fly without shuting down the Laptop... ROTFL! All for only 114 on german eBay. Thanks in avance -- Michelle KonzackMiila ITSystems @ TDnet GNU/Linux Developer 00372-54541400 -- https://mail.python.org/mailman/listinfo/python-list
Re: New to Python and understanding problem
Good morning, Am 2018-01-30 hackte careenjosep...@gmail.com in die Tasten: > One contributing factor to this problem is the artificial environment that > online courses provide to students. Students are usually typing code into > a web page that contains instructions and hints. This is not how real > programming gets done. So when the course is over and itâs time to use a > real programming environment, students feel lost without the environment > that they are accustomed to. I started coding in 1984 with ASM on a 8049 Microcontroller and since then, I was always looking into other sourcecodes to understand how something is working. I have no clue about Python, but I feel very well/comfortable with it. I think, it is not very complicate to learn, because python is very logic structured. This is why I just go the idea of bug-hunting in the blueman app. Thanks in avance -- Michelle KonzackMiila ITSystems @ TDnet GNU/Linux Developer 00372-54541400 -- https://mail.python.org/mailman/listinfo/python-list
Re: New to Python and understanding problem
Hello peter and *, Am 2018-02-03 hackte Peter J. Holzer in die Tasten: > On 2018-01-29 19:14:57 +0100, Michelle Konzack wrote: >> Am 2018-01-29 hackte Dan Stromberg in die Tasten: >> > I don't see blueman on pypi, so this is probably part of the package >> > you downloaded, and not something you need to "pip3 install". >> >> I have Python 2.7 and 3.5 from the Debian GNU/Linux repository installed >> I use the Stable (Stretch) version. >> >> Installing blueman 2.0.4 (for Python 2.7) ended with a SEGFAULT. > > How did you install this? When I install blueman-2.0.4-1 from the Debian > Stretch (i386) apt repository, it uses Python3: > > hjp 16620 2.0 0.5 110192 44316 pts/24 Sl+ 11:40 0:00 > /usr/bin/python3 /usr/bin/blueman-applet > > And it seems to work (the icon shows up in the task bar and I can open > the menu. I don't have any bluetooth hardware on my desktop, so I can't > test that). > > A segfault is probably caused by a library, not by Python. If you got > blueman from the Debian repository, report the problem at > https://bugs.debian.org > >> Hence I downloaded the sources 2.1~alpha2 from the Experimantal Mirror, >> comiled and packed it as Backport. >> >> Anything went fine, except, if I execute /usr/bin/blueman-applet it >> does not find the path to blueman which is in >> >> /usr/lib/python-3.5/site-packages >> >> as subdirectory "bluman". > > This looks like a packaging error. AFAICS python3 packages on Debian are > normally installed directly under /usr/lib/python3.5, not under > /usr/lib/python-3.5/site-packages or /usr/lib/python-3.5/dist-packages > (although the latter is on sys.path). Unless you have modified this > yourself, please report it to Debian. I do not know what was in the experimental sources, but it seems a make clean has removed something and when I recompiled the package, it was correctly working. However, I use xorg, fvwm, trayer, blueman-applet like pasystray and was searchin the whole internet to solv this problem. Had installed and deinstalled packages and now it is magicaly working. Now I have to figure out, which of the packages pulled a missing dependency into the system. It is sad, that only monsters like KGE (it would install 1,8GByte on my system) and GNOME have all the right dependencies. But if you install something like debian base alsa xorg wdm fvwm vlc trayer blueman pasystray nothing is working! I think the above packages should install a working system! Now I have to figure out, WHY ALSA is working (pasystray show it) but there is no sound coming out of the speakers. I say only: "Welcome to the dependeny hell!" Thanks in avance -- Michelle KonzackMiila ITSystems @ TDnet GNU/Linux Developer 00372-54541400 -- https://mail.python.org/mailman/listinfo/python-list
Re: Gmane seems to be gone
The Whois Registry was updated today for the next 12 month. Am 2018-02-18 hackte Grant Edwards in die Tasten: > I've been dreading this moment for a couple years: it looks like > gmane.org is gone. The original operator/maintainer gave up a couple > years ago and pulled the plug. Somebody else took over at that point. > The Web UI was never revived, but the basic NNTP<->mailing-list gateway > continue to work -- until tonight. Now the domain is gone. Perhaps > it's just an oversight, but I've got a bad feeling... > > I really, really prefer using slrn and an NNTP server to follow > mailing lists, and I was using gmane to follow about a dozen of them > (including the Python list). At least for python, there's still a > Usenet gateway. Unfortunately, that's not true for any of the other > lists that I used to follow on gmane.org. > > Does anybody have any idea what it would take to set up a private NNTP > server that served articles from a dozen or so IMAP mailboxes? > > How hard would it be to write something like that in Python? I've got > a pretty good handle on the IMAP end of things, but I've got no clue > about the NNTP server end. Thanks in advance -- Michelle KonzackMiila ITSystems @ TDnet GNU/Linux Developer 00372-54541400 -- https://mail.python.org/mailman/listinfo/python-list
Re: Gmane seems to be gone
Hi Grant, Am 2018-02-18 hackte Grant Edwards in die Tasten: > Does anybody have any idea what it would take to set up a private NNTP > server that served articles from a dozen or so IMAP mailboxes? Where is the problem? I have my own Root-Server am subscribed with 32 mail accounts to arround 120 mailinglists every mailaccount is a group like "Debian", "Devel", ... I use the courier-imap Server which allow me to setup shared folders... Which mean, any user of my mailserver can add this shared folders to his own account! Hence, he has a copy of the Mailinglist... ;-) and of course, it works with any decent IMAP clients. However, under Windows there are a bunch of problems (lake of capabilities) Have a nice Sunday -- Michelle KonzackMiila ITSystems @ TDnet GNU/Linux Developer 00372-54541400 -- https://mail.python.org/mailman/listinfo/python-list
Regular Expression question
I have a script that needs to scan every line of a file for numerous strings. There are groups of strings for each "area" of data we are looking for. Looping through each of these list of strings separately for each line has slowed execution to a crawl. Can I create ONE regular expression from a group of strings such that when I perform a search on a line from the file with this RE it will search the line for each one of the strings in the RE ? Michelle <>-- http://mail.python.org/mailman/listinfo/python-list
Error installing python on Windows
Hello all I am new to python. Trying to install Python and encountered this error message : "The program can't start because api-ms-win-crt-runtime-I1-1-0.dll is missing from your computer." Tried to repair and reinstall Python however i may have missed out some installation. What should I do to resolve this issue? Thanks for your help! -- https://mail.python.org/mailman/listinfo/python-list