Re: ModuleNotFoundError: No module named 'Paramiko'
To be sure, you can always go the the directory of the Python interpreter and open a cmd window there. (By entering 'cmd' into the explorer address bar.) Then enter 'python.exe -mpip install paramiko'. This way you can be sure that you're not running a pip.exe that belongs to another Python interpreter. -- https://mail.python.org/mailman/listinfo/python-list
Re: Windows Gui Frontend
On 02.04.2023 18:26, Michael Torrie wrote: Been a long time. I was initially turned off by the event handling system of wx compared to the signals and slots of Gtk and Qt. When starting with Python GUIs in 1999, I evaluated both. Qt event handling had an advantage for C++ where the wxWidgets people had to use event tables. I don't know when wxWidgets added dynamic event binding, but with wxPython I don't know anything else than dynamic binding. Regards, Dietmar -- https://mail.python.org/mailman/listinfo/python-list
Re: Windows Gui Frontend
On 02.04.2023 18:20, Michael Torrie wrote: Well the thing is you don't need to generate Python code at all. Qt provides a UI loader class that loads the UI file at run time, builds the objects in memory, and connects all your signals for you. I know, but having to load the .ui file is awkward. Even worse, you lose things like code completion. So much nicer than code generation. I absolutely disagree on this. Regards, Dietmar -- https://mail.python.org/mailman/listinfo/python-list
Re: Windows Gui Frontend
On 02.04.2023 16:45, Michael Torrie wrote: But any modern GUI toolkit has sizers and layout managers. If you're manually placing elements you cannot deal with HiDPI or changing window sizes. Rearranging happens automatically when using sizers and layout managers. I did not talk about pixel placement with wxGlade. That's not supported. It's of course using sizers and with a hierarchy of sizers it's much easier to rearrange things than it would be with pixel placement. GUI designer tools (Qt Creator, Visual Studio) can be used to assist and help layout the skeleton, but ultimately the GUI is defined by code. And That's what I hated with Qt Designer: it does not output Python code but a .ui file. This was the point where I could not recommend it to anyone. I've tried wxGlade but never could get into it, or wxWidgets in general. Which version? Up to 0.7.2 I agree. but the future of Qt is clearly QtQuick, so I've been learning that. Has its warts, but in general I like the declarative paradigm. It's a learning curve. Overall it's fairly powerful, flexible and portable. I For me QtQuick and QML are a step backwards by some ten years when it comes to development speed. It's as much 'fun' as doing GUIs with HTML and JavaScript. Unfortunately, The Qt Company refused to provide an API for QtQuick to be able to use it without QML. Anyway, desktop development has long moved out of their focus (around 15 years ago when Nokia acquired Trolltech). It's not where their commercial customers are. Regards, Dietmar -- https://mail.python.org/mailman/listinfo/python-list
Re: Windows Gui Frontend
On 02.04.2023 01:13, Alan Gauld wrote: I did a deep dive examination of GUI builders back around v2.6 and came away less than enthused. Things may have improved since then but I've seen no real evidence of that. I also did evaluate all the GUI builder from time to time between 2000 and 2016 to find one that I could recommend to colleagues, but could not find one. Then I started contributing to wxGlade and I can say that since a few years it's as easy again to build GUIs as it was with VB6. I don't want to go back to coding GUIs manually. For most use cases it's a waste of time and often it does not result in the best GUI as it's not so easy to try out and rearrange elements. Regards, Dietmar -- https://mail.python.org/mailman/listinfo/python-list
Re: Windows Gui Frontend
On 01.04.2023 19:30, Igor Korot wrote: Look at wxGlade (a project designed for wxWidgets). You will design you layout and then just save it as a py file. wxGlade also includes a tutorial to get you started with wxPython itself. You should be able create basic GUIs within a few hours. See https://discuss.wxpython.org/ for support on wxPython and the wxGlade mailing list. Regards, Dietmar -- https://mail.python.org/mailman/listinfo/python-list
Re: IDE tools to debug in Python?
On 27.01.2021 20:07, C W wrote: I'm not expert in Python, but I sure tried many IDEs to kick off Python programming. I started with PyCharm, but I had a problem with it constantly scanning the background, even after I turned that feature off. My favorite (I'm using now) is VS Code with Python extension, it's very light. Recently also started background scanning, but that's generally done in 30 seconds. There's also Wing IDE (Pro). The best is to try at least PyCharm and Wing IDE (Pro) and maybe one or more of the others. Besides the debugger experience from the 90's please note that stepping through a program is not the most valuable feature of the Python debuggers: Python is an interactive language. You can develop a lot while working on a Python console. Then copy and paste into a program. Especially for hardware control, network programming and GUI development I find that the most valuable feature of Python. (Maybe you have used Forth in the 90s as well, then you will know this feature.) The better debuggers have a built-in console. See here for a screenshot of Wing's debug console exploring GUI code: http://wxglade.sourceforge.net/docs/_images/Calculator_Debugger.png Regards, Dietmar -- https://mail.python.org/mailman/listinfo/python-list
Re: How do you debug in Python? Coming from a Matlab and R user. I'm already aware of pdb.
On 27.01.2021 01:52, Skip Montanaro wrote: Agree with Grant on these points. I certainly use gdb to debug C code (like the interpreter), but for Python code, tracebacks and print statements pretty much take care of things. I thought so for the first 12 year of using Python. For the last 12 years I have been using an IDE/debugger with built-in console. It boosted productivity by at least a factor of two. Sometimes "python -i ..." and "import pdb" is good enough, being able to inspect variables after an exception. I have the impression that pdb as post mortem debugger is not well known... Regards, Dietmar -- https://mail.python.org/mailman/listinfo/python-list
Re: GUI: I am also looking for a nudge into the best (GUI) direction.
On 29.10.2020 16:54, flaskee via Python-list wrote: Thank you for your help in advance! Maybe, you should outline what you actually want to accomplish on each platform group (desktop / mobile). Regards, Dietmar -- https://mail.python.org/mailman/listinfo/python-list
Re: GUI (tkinter) popularity and job prospects for
On 23.10.2020 18:52, John Pote wrote: I've used tkinter and wxPython occasionally in the past for 1 off test tasks (and interest). What's the advantage of Qt? Qt does support mobile and touch oriented user interfaces. Also, it does support GUI programs on microcontrollers now on bare-metal. Desktop development has long moved out of the focus of the Qt company. (This shift dates back to the time when Nokia was the owner.) Just have a look at their start page and you know the focus. Qt company is living from expensive industry licenses. Providing frees solutions to the open source community is not the core business. Qt still supports traditional desktop development in form of Qt Widgets, but there's pressure to move to QML. This is more comparable to the HTML/CSS/Javascript approach. Personally I would not want to go that way for desktop applications. The traditional single-language approach with API and debugger seems much more straightforward and time-saving. For many types of desktop applications I would just recommend wxPython, together with wxGlade as a GUI builder. This will provide a quick start and high productivity for many tasks. That's another point: Qt Designer is recognized as one of the most advanced GUI builders, but when you actually want to use it with Python it does not really help you much. Using it is too complicated for the beginner or casual user and for the advanced user it's easier to avoid it completely. Regards Dietmar -- https://mail.python.org/mailman/listinfo/python-list
Re: How to delay until a next increment of time occurs ?
On 14.11.2019 21:00, R.Wieser wrote: There is a small 433 MHz rf transmitter connected to the pin, and when I send the right pattern a wireless wall-wart will respond and switch a lamp on or off. Its just ment as an example of a real-world application of Python, nothing serious. I would assume that this is not an application that needs to output a 100% correct pulse train every time. (Based on the assumption that the telegrams for on and off are different enough.) You may just repeat the pattern ten times to be safe enough. Combine it with a light sensor for feedback ;-) Btw. you may want to increase the priority of your task. I'm using this code on my Raspi to reduce the interference of other processes with my media player using Python with gstreamer: os.system( "sudo renice -15 -p %d"%os.getpid() ) Anyway, Micropython on a microcontroller would probably be the best solution. Regards, Dietmar -- https://mail.python.org/mailman/listinfo/python-list
Re: How to delay until a next increment of time occurs ?
On 13.11.2019 21:20, R.Wieser wrote: 300us is getting on towards realtime. Not really. Translated to a frequency (toggeling the pin) it would be just 1.6 KHz. Thats rather slow for an ARM machine running on 1.4 Ghz (about a million times as fast). It *is* real-time... Real-time is not about speed, but about guaranteed timing. Not possible: the 300 uSec is the basic timing, but the pin isn't always changed on every tick of it (the result is a code train). With Micropython I did successfully use timer and DMA to accomplish something like that (in the 100ns range, though). With a mainloop and delays you can't guarantee to meet your requirements, at least not on a multitasking non-realtime system. Regards, Dietmar -- https://mail.python.org/mailman/listinfo/python-list
Re: How to delay until a next increment of time occurs ?
On 13.11.2019 23:20, Dennis Lee Bieber wrote: For Windows it may require coding a busy-wait sleep function using the high-performance counter and computing a counter value (modulo?) on which to exit the loop. time.perf_counter() is using this on Windows. I'm just worried about floating point limitations on older Python versions. From Python 3.7 onwards, there's time.perf_counter_ns(), but even then it would be nice if it was just possible to reset the perf_counter. Regards, Dietmar -- https://mail.python.org/mailman/listinfo/python-list
Re: How to delay until a next increment of time occurs ?
On 13.11.2019 19:21, R.Wieser wrote: Yup. But the cost of using that command is generating threads - which some search results warned against (not sure why though). I'm currently looking for a way to have short breaks (in the range of 10us to some ms) on Windows and time.sleep() always seems to be too long, probably due to thread switching. From looking at the source code, it could behave better with Linux, but anyway such solutions will always create a lot of Jitter. The best solution I can think of would be a build-in (hardware?) timer which would generate "ticks" until its stopped. Actually, with such requirements you're usually better off with a microcontroller. These have timers and interrupts available. Maybe the PyBoard with Micropython is the right tool for you. I'm using it for some measurement and control applications and it's really great. Regards, Dietmar -- https://mail.python.org/mailman/listinfo/python-list
Re: Python 2 EOL; what about P2 packages
On 12.05.2019 16:38, GerritM wrote: Any suggestions how to port to Python 3, when using Python 2 only packages? You need to decide for each package whether to port it or to replace it. HTMLgen is probably a pure Python package. It should not be too hard to port it to Python 3 yourself. At the time, mx.DateTime filled a gap. Python has had a standard module 'datetime' for some years now. When moving to Python 3 I replaced my usages of mx.DateTime with datetime and pytz. Regards, Dietmar -- https://mail.python.org/mailman/listinfo/python-list
Re: ANN: Creating GUI Applications with wxPython
On 27.02.2019 20:34, Dan Sommers wrote: What is a "network widget" in this context? Application users don't usually interact with "the network" directly, and networks are usually on the opposite end of applications from the GUI. What would your hypothetical network widget do? What cross-platform differences would it abstract/hide? What do your applications do to/with/against "the network"? Probably an integration of sockets with the main loop to allow for asynchroneous communication. Qt has a socket class that will deliver events when data is received or transmitted. It's a long time that I had a look at this, but I think it's available from PyQt as well. Alternatively, I have successfully used Quamash, which is an integration of the Qt event loop with asyncio. For new projects, I would always recommend to use asyncio as this is available in the standard library. For wxPython there is some code to integrate with asyncio, but I have never used this myself. Alternatively, the communication can always be placed into a separate thread, posting events to the main application / frontend. Regards, Dietmar -- https://mail.python.org/mailman/listinfo/python-list
Re: ANN: Creating GUI Applications with wxPython
On 27.02.2019 16:10, Dave wrote: I have two Python 3 (3.6) apps that will get the full GUI treatment very soon. I'm in the process of choosing a GUI, and that may be where you/your book can help. Seems this is not a trivial effort (wishing that Python was like VB6 from the 90's). IMHO what comes closest to VB6 is wxPython with wxGlade. The focus of wxGlade is on frames and dialogs with standard widgets, though. Graphics and printing is always a bit more effort. Regards, Dietmar -- https://mail.python.org/mailman/listinfo/python-list
Re: Python library to break text into words
On 5/31/2018 10:26 PM, beliavsky--- via Python-list wrote: Is there a Python library that uses intelligent guesses to break sequences of characters into words? The general strategy would be to break strings into the longest words possible. The library would need to "know" a sizable subset of words in English. No need to re-invent the wheel: import webbrowswer webbrowser.open( "https://www.google.com/search?q=%s"%"atomicaccidents.pdf"+"+amazon";, new=0) Copy the title from the browser window and paste it into your script's window which will read it with input() and rename the file. Regards, Dietmar -- https://mail.python.org/mailman/listinfo/python-list
Re: RFC: Proposal: Deterministic Object Destruction
On 3/4/2018 1:37 PM, Ooomzay wrote: Not so:- CPython, the reference interpreter, already implements the required behaviour, as mentioned in the PEP. It does most of the time, but it's not guaranteed. See my previous post. Regards, Dietmar -- https://mail.python.org/mailman/listinfo/python-list
Re: RFC: Proposal: Deterministic Object Destruction
On 2/28/2018 11:51 PM, ooom...@gmail.com wrote: This PEP proposes that valid python interpreters *must* synchronously destroy objects when the last reference to an object goes out of scope. This interpreter behaviour is currently permitted and exhibited by the reference implementation [CPython], but it is optional. CPython does *not* guarantee destruction when the object reference goes out of scope, even if there are no other references. I would very much appreciate such a deterministic behaviour, at least with CPython. I recently had to debug an issue in the matplotlib wx backend (*). Under certain conditions, the wx device context was not destroyed when the reference went out of scope. Adding a del to the end of the method or calling the Destroy method of the context did fix the issue. (There was also a hidden reference, but avoiding this was not sufficient. The del was still required.) (*) https://github.com/matplotlib/matplotlib/issues/10174 Regards, Dietmar -- https://mail.python.org/mailman/listinfo/python-list
Re: Simple graphic library for beginners
On 1/11/2018 8:51 PM, bartc wrote: I downloaded Python 3.7. It didn't work. I uninstalled and reinstalled it, this time with the 'set environment variables' option (to allow 'pip' to be typed from anywhere). You can't expect that people provide binary installers for Python versions that are alpha. Why not try a released version? You can see on https://pypi.python.org/pypi/Pygame that there are wheels for e.g. Python 3.6, 3.5, 3.4, 2.7. Other versions will be built from sources and this is certainl more complicated... (I have not tried it myself. There might be dependencies to other binaries like a SDL binary installation.) Regards, Dietmar -- https://mail.python.org/mailman/listinfo/python-list
Re: Linux/Windows GUI programming: tk or wx?
On 8/5/2017 1:45 AM, Ulli Horlacher wrote: Any kind of installer is not acceptable. Is the requirement "no installer" or "single file" or both? You can satisfy the "no installer" requirement also by just distributing the .py file, the interpreter and a .bat file that e.g. contains "python27\python.exe programm.py". I have been doing this for years, sometimes just letting people run the .bat from a network share. Is there a recommendation for using tk or wx? I would recommend wx. For Python 2.7 you can use either the 'Classic' version 3 or the new version 4 called 'Phoenix'. I have been using Python 2 plus Classic for 15 years and have switched to Python 3 and Phoenix a year ago. If you plan to switch to Python 3 at any time then go for Phoenix right now. The pyinstaller may not yet support Phoenix, which is e.g. required for Python 3. So you may be restricted to the Classic version. Classic: https://sourceforge.net/projects/wxpython/files/wxPython/3.0.2.0/ Phoenix: https://pypi.python.org/pypi/wxPython/4.0.0b1 (It's still beta, but is perfectly usable.) For documentation, get the book "wxPython in Action". For questions there's a helpful mailing list wxpython-users. If your requirement is basically to have some user input forms, then you should give wxGlade a try (use the version from the repository https://bitbucket.org/wxglade/wxglade/get/default.zip as a release is in preparation; then press F1 for the tutorial). A GUI builder should make the start much easier, especially when it comes to Sizers (the layout managers). Regards, Dietmar -- https://mail.python.org/mailman/listinfo/python-list
Re: Choosing a Python IDE. what is your Pythonish recommendation? I do not know what to choose.
On 06.01.2017 09:40, Antonio Caminero Garcia wrote: So why not use the debugger interactively to develop applications. As long as one sets the breakpoints in a meaningful way so you can trace your code in a very productive way. Is that what you mean by interactive environment? Well, not exactly. Maybe have a look at the video "Interactive Debug Probe" at https://wingware.com/wingide/debugger Regards, Dietmar -- https://mail.python.org/mailman/listinfo/python-list
Re: Choosing a Python IDE. what is your Pythonish recommendation? I
On 04.01.2017 07:54, Antonio Caminero Garcia wrote: > Unfortunately most of the time I am still using print and input functions. I know that sucks, I did not use the pdb module, I guess that IDE debuggers leverage such module. pdb is actually quite useful. On my Windows PCs I can invoke python on any .py file with the -i command line switch by right clicking in the Explorer and selecting "Debug". Now when the script crashes, I can inspect variables without launching a full-scale IDE or starting the script from the command line. For such quick fixes I have also a context menu entry "Edit" for editing with Pythonwin, which is still quite OK as editor and has no licensing restrictions or installation requirements. This is a nice option when you deploy your installation to many PCs over the network. For the print functions vs. debugger: The most useful application for a debugger like Wing is not for bug-fixing, but to set a break point and then interactively develop on the debugger console and with the IDE editor's autocompletion using introspection on the live objects. This is very helpful for hardware interfacing, network protocols or GUI programs. It really boosted my productivity in a way I could not believe before. This is something most people forget when they evaluate programming languages. It's not the language or syntax that counts, but the overall environment. Probably the only other really interactive language and environment is Forth. > If it happens to be Arduino I normally use a sublime plugin called Stino > https://github.com/Robot-Will/Stino > (1337 people starred that cool number :D) Well, it is CodeWarrior which was quite famous at the time of the 68k Macs. The company was bought by Motorola and the IDE is still around for Freescale/NXP/Qualcomm microcontrollers like the HCS08 8 bit series. Around ten years ago the original CodeWarrior IDE was migrated to something Eclipse based. When I last evaluated HCS08 vs. Arduino, the HCS08 won due to the better debug interface and native USB support. HCS08 is still quite cool, but when it comes to documentation, learning curve, tools etc. the Arduinos win Regards, Dietmar -- https://mail.python.org/mailman/listinfo/python-list
Re: Choosing a Python IDE. what is your Pythonish recommendation? I
On 04.01.2017 15:41, William Ray Wing wrote: > I use Wing, and I think you will like it. It *is* pythonic, and for what it is worth, offers remote debugging as one of its more recently added features. Obviously, you had no other choice than using Wing ;-) The remote debugging has been around for some years. I have been using it quite often to debug on my Raspberry Pi, Nokia N900 and Jolla Phone, all running some Linux system. It works well. It is or was a bit complicated to set up. I think this has been improved with Wing 6, but I did not need it in the last weeks, so I don't know. Regards, Dietmar -- https://mail.python.org/mailman/listinfo/python-list
Re: Choosing a Python IDE. what is your Pythonish recommendation? I
On 02.01.2017 12:38, Antonio Caminero Garcia wrote: > The thing with the from-the-scratch full featured IDEs (Eclipse, IntelliJ, Pycharm) is that they look like a space craft dashboard and that unwarranted resources consumption and the unnecessary icons. You did not try Wing IDE? It looks less like a spacecraft. Maybe you like it. Maybe the difference is that Wing is from Python people while the ones you listed are from Java people. For something completely different (microcontroller programming in C) I just switched to a Eclipse derived IDE and I don't like it too much as the tool does not focus on the problem scope. From your posts I'm not sure whether you want an editor or an IDE, where for me the main difference is the debugger and code completion. I would not want to miss the IDE features any more, even though in my first 15 years of Python I thought that a debugger is optional with Python ... Regards, Dietmar -- https://mail.python.org/mailman/listinfo/python-list
Re: Choosing a Python IDE. what is your Pythonish recommendation? I do not know what to choose.
On 04.01.2017 15:41, William Ray Wing wrote: I use Wing, and I think you will like it. It *is* pythonic, and for what it is worth, offers remote debugging as one of its more recently added features. Obviously, you had no other choice than using Wing ;-) The remote debugging has been around for some years. I have been using it quite often to debug on my Raspberry Pi, Nokia N900 and Jolla Phone, all running some Linux system. It works well. It is or was a bit complicated to set up. I think this has been improved with Wing 6, but I did not need it in the last weeks, so I don't know. Regards, Dietmar -- https://mail.python.org/mailman/listinfo/python-list
Re: Choosing a Python IDE. what is your Pythonish recommendation? I do not know what to choose.
On 04.01.2017 07:54, Antonio Caminero Garcia wrote: Unfortunately most of the time I am still using print and input functions. I know that sucks, I did not use the pdb module, I guess that IDE debuggers leverage such module. pdb is actually quite useful. On my Windows PCs I can invoke python on any .py file with the -i command line switch by right clicking in the Explorer and selecting "Debug". Now when the script crashes, I can inspect variables without launching a full-scale IDE or starting the script from the command line. For such quick fixes I have also a context menu entry "Edit" for editing with Pythonwin, which is still quite OK as editor and has no licensing restrictions or installation requirements. This is a nice option when you deploy your installation to many PCs over the network. For the print functions vs. debugger: The most useful application for a debugger like Wing is not for bug-fixing, but to set a break point and then interactively develop on the debugger console and with the IDE editor's autocompletion using introspection on the live objects. This is very helpful for hardware interfacing, network protocols or GUI programs. It really boosted my productivity in a way I could not believe before. This is something most people forget when they evaluate programming languages. It's not the language or syntax that counts, but the overall environment. Probably the only other really interactive language and environment is Forth. If it happens to be Arduino I normally use a sublime plugin called Stino https://github.com/Robot-Will/Stino (1337 people starred that cool number :D) Well, it is CodeWarrior which was quite famous at the time of the 68k Macs. The company was bought by Motorola and the IDE is still around for Freescale/NXP/Qualcomm microcontrollers like the HCS08 8 bit series. Around ten years ago the original CodeWarrior IDE was migrated to something Eclipse based. When I last evaluated HCS08 vs. Arduino, the HCS08 won due to the better debug interface and native USB support. HCS08 is still quite cool, but when it comes to documentation, learning curve, tools etc. the Arduinos win Regards, Dietmar -- https://mail.python.org/mailman/listinfo/python-list
Re: Choosing a Python IDE. what is your Pythonish recommendation? I do not know what to choose.
On 02.01.2017 12:38, Antonio Caminero Garcia wrote: The thing with the from-the-scratch full featured IDEs (Eclipse, IntelliJ, Pycharm) is that they look like a space craft dashboard and that unwarranted resources consumption and the unnecessary icons. You did not try Wing IDE? It looks less like a spacecraft. Maybe you like it. Maybe the difference is that Wing is from Python people while the ones you listed are from Java people. For something completely different (microcontroller programming in C) I just switched to a Eclipse derived IDE and I don't like it too much as the tool does not focus on the problem scope. From your posts I'm not sure whether you want an editor or an IDE, where for me the main difference is the debugger and code completion. I would not want to miss the IDE features any more, even though in my first 15 years of Python I thought that a debugger is optional with Python ... Regards, Dietmar -- https://mail.python.org/mailman/listinfo/python-list
Re: [FAQ] "Best" GUI toolkit for python
On 18.10.2016 00:58, pozz wrote: So I'm thinking to evaluate other solutions. wxWidgets is attractive for it's native look&feel, but python implementation Phoenix for Python3 is in alpha stage. Moreover wxGlade (the GUI builder application) needs Python2, but I couldn't understand if the generated code is compatible with wxPython/Phoenix. I can recommend wx. I have been using wxPython for more than 15 years and Phoenix for about one year now. Phoenix has been working quite stable for me. It's not released yet finally, but there's much work going on to make a release happen. For learning: - get the book "wxPython in Action" - download the snapshot, including the html documentation and source archive from https://wxpython.org/Phoenix/snapshot-builds/ - bookmark the comparison at https://wxpython.org/Phoenix/docs/html/classic_vs_phoenix.html - unpack the demo directory from the source archive and run demo.py; maybe also have a look at the samples directory - also download the chm file from https://github.com/wxWidgets/wxWidgets/releases/download/v3.0.2/wxWidgets-3.0.2-docs-chm.zip (you may prefer the single file chm documentation, even though it's for C++; for a start look at Categories -> Class List by Category -> Controls / Window Layout / Events / Managed Windows / Miscellaneous Windows / Common Dialogs) The demo is the most important resource for learning! In the last months I spent a lot of time to make wxGlade more usable and maintainable. It runs already under Phoenix. Just use the DEV_DS_2016 branch from the repository (it can be downloaded as zip from https://bitbucket.org/wxglade/wxglade/downloads?tab=branches ) When wxGlade runs under Phoenix, the generated code should be Phoenix compatible. This version is not yet released and also the Phoenix support is not yet official. It should fit your purpose, though and it's probably the easiest option to get started with a Python GUI. Please provide bug reports and also general feedback about potential improvements. For 100% Phoenix support I need to modify a lot under the hood, but I hope to have it done not too late after a wxPython Phoenix release. A better menu editor, better integration with custom code and a new tutorial are on the todo list. Contributions are welcome. Just as you seem to do, I also see the old Visual BASIC versions as reference when it comes to creating a GUI without much learning and effort. The current wxGlade tutorial does not yet reflect the fact that you can now edit the structure directly in the tree view. Regards, Dietmar -- https://mail.python.org/mailman/listinfo/python-list
Re: Touch screen development in Python
On 12.07.2016 21:10, Jahn wrote: I was thinking about Python touch screen applications for industrial boards( computers). If I have a touch screen with that industrial board, what I must have installed to be able to write touch screen applications in Python? This could be any platform: QNX, Android, Windows, Embedded Windows, Windows CE, Windows Mobile, Linux with X, Linux with Wayland, Linux command line and a display connected via SPI or whatever... If you don't write which platform you actually have, you will probably not get answers that will help you. Regards, Dietmar -- https://mail.python.org/mailman/listinfo/python-list
Re: Touch screen development in Python
On 11.07.2016 19:21, Jahn wrote: Does anyone use Python for developping applications that work with a touch screen? Yes. You should probably specify the platform and the type of applications that you're interested in. Mobiles (Android, iOS, Sailfish OS)? Windows 10 Tablets? Ubuntu Touch? Embedded systems? Regards, Dietmar -- https://mail.python.org/mailman/listinfo/python-list
Re: Recommendation for GUI lib?
On 07.06.2016 23:45, Roland Koebler via Python-list wrote: Both are free, have Python bindings and a graphical GUI designer, and both have ports for Windows and Mac OS X. Qt does have a better cross-platform- support and supports more platforms, but GTK+3 also works for Linux, Mac OS X and Windows. What is the current state and quality of GTK for Windows and Mac OS? IIRC it's not too long that Wing IDE was moved from PyGTK to Qt due to the problems under Windows and MacOS. Regards, Dietmar -- https://mail.python.org/mailman/listinfo/python-list
Re: Recommendation for GUI lib?
On 07.06.2016 09:22, Nick Sarbicki wrote: I think that's a bit of an unfair statement. Sure conversion can be a bit of a pain and there is some setup for getting the classes working. But that is generally a small static piece of code you can find all over the net, which is then usable for most projects. The small static piece will just import the GUI. Still then, if the GUI actually serves a purpose, you need to address all the controls and events yourself. At that point, you will soon find that you need to know as much as if you created the GUI in code. Anway, for GUI development I recommend using a good debugger like that of Wing IDE. Just set a breakpoint or wait for an exception and then write the GUI in the debugger utilizing the introspection features. But for me, once past the understanding, coding GUIs by hand is about as dull as it gets. Qt creator definitely makes the work go faster. For starting into wxPython I did use wxDesigner. For the first steps into Qt (PySide at that time), I did use Qt Creator. But beyond the the first steps and getting used to sizers, currently you're better off with coding the GUI, probably utilizing your previous code for copy&paste (or with wxPython, copy&paste from the demo). Still, I would like to see a decent GUI builder with RAD features enabling also newcomers to write GUI programs. Most GUI programs just need a form to enter something and a start or save button to trigger the action. The steep learning curve for Python GUIs is holding back many people from using Python for e.g. measurement automatization. It's almost impossible to 'sell' a console-only environment in corporate environments. And the process that is required to implement a GUI using Qt Designer is not much of an improvement either. IMHO, as of today the only GUI builder that could be developed into this RAD direction is wxGlade. For Qt Designer it would be possible to bridge the gap by adapting an IDE, though (like Eric tries). Regards, Dietmar -- https://mail.python.org/mailman/listinfo/python-list
Re: Recommendation for GUI lib?
On 05.06.2016 01:08, John Pote wrote: Qt and Qt Creator often come up in searches for Python GUI libraries. I need to decide weather to upgrade to wxPython.Phoenix and Python 3.5 (as soon as I upgrade to win 7!) or switch to Qt which I don't know at all. It would be interesting to hear your experiences of trying Qt and why you've stuck with wxPython in the end. Python 2.7 and wx are working well under Win 7. But there are other problems like e.g. some bugs that I faced with the Win 32 extensions. For many libraries you can no longer expect first class support with 2.7. I have been using wxPython on the desktop since around 2000. Porting my main desktop application with several MB GUI related code to another toolkit is certainly not an option. The lack of a Python 3 compatible wxPython did hold me back from moving to Python 3 for some years, but when I tried last year, I was positively surprised as it took only one evening to port my application. OK, then it took me some evenings to implement e.g. Metafile support for Phoenix. Nowadays almost all features from the classic wxPython should be available in Phoenix as well. Even though Phoenix is not yet released, I did not face any instabilities (except maybe that the virtual grid is a bit more picky than it used to be when it comes to dynamic grid cell attributes). I'm using Qt sometimes for small apps on my mobiles (Sailfish OS and, before that, Maemo). I don't see a reason to change from wx to Qt on the desktop. I'm not convinced about whether Qt Widgets have too much of a future at all. The 'traditional' development has moved out of the focus of the Qt team a long time ago (when Trolltech was aquired by Nokia). The suggestion is to use QML now, but there's no pythonic way to develop QML / Qt Quick based GUIs as there's no C++ API which could be used as base for this. OK, Qt has one advantage: using Quamash you can integrate the asyncio and the qt main loops. Without Python 3 support there has not yet been a need to have this for wx... Qt Designer is certainly a good GUI builder, but not more than that. When you actually want to use the designed GUI in Python, you will find that this needs almost as much know how and work as if you did the GUI in code. Regards, Dietmar -- https://mail.python.org/mailman/listinfo/python-list
Re: Recommendation for GUI lib?
On 02.06.2016 12:35, John Pote wrote: I've used wxPython (www.wxpython.org) for a few GUI projects and found it ok. It's a wrapper for the wxWidgets C++ library. There's even a reasonable free GUI builder, wxGlade, which I use as I prefer constructing GUI's that way rather than writing raw wxPython code. Never tried any of the paid for GUI builders. Disadvantage is the download page only provides builds for Python 2.6 or 2.7. Does anyone know how Project Phoenix is coming on? http://wxpython.org/Phoenix/ItsAlive/ shows wxPython working with Python 3.2. Comments on how stable it is and how easy to install would be helpful. I have been using Phoenix now for half a year and are very happy with it. A release is on its way. For most platforms there are snapshot builds which are easy to install. See e.g. https://groups.google.com/d/msg/wxpython-users/soHFLOrerVs/MSijBTQ6KAAJ The snapshot installation does not include the demo and the .chm help file (yet?). These and the book I found to be the most helpful resources (much more usable than online reference documentation as e.g. with Qt). I think that wxGlade is the most promising Python GUI builder and I'm confident that it will see improvements to increase usability. I have tried some others from time to time, including also QtCreator, but none was really convincing. Regards, Dietmar -- https://mail.python.org/mailman/listinfo/python-list
Re: Everything good about Python except GUI IDE?
On 28.02.2016 19:47, mm0fmf wrote: I'm no C# expert but I inherited the support of some C# projects. One uses a form to hold the UI objects. When the program is loaded in VS, you see the form and you can drag and drop objects to the form and edit the object properties (text, font, colours etc.). The result of your visual work is rendered in the C# source with some code folding options. If you don't click the folds in the editor you don't get to see that the form editor generates the C# code you need to call to generate the objects. There are suitable comments through the generated code warning you not to edit it as it is regenerated etc. The result is you use a visual tool to generate the boiler plate code. Knowing MS tools I'd be very suprised if the same idea is not used in VB. Somewhere there will be a text file with the VB boilerplate code to generate the form. The VB 6 setup was different. GUI editor, IDE and runtime were tightly integrated. In VB 6, you don't see such boiler plate code. You only see the form, the textual representation of the form and the code that you enter into the event handlers etc. The form is then rendered by the VB runtime. But what you outlined for C# is probably the way that the ideal Python GUI editor would go. When you think about how a RAD tool could look like and how to integrate with IDEs, you automatically come to such a setup with comments as markers/separators for the automatically generated code. Regards, Dietmar -- https://mail.python.org/mailman/listinfo/python-list
Re: Everything good about Python except GUI IDE?
On 28.02.2016 18:03, Dennis Lee Bieber wrote: Office 2002 (or was it 2003... Whatever I had on my WinXP box) was, I thought, rather easy to work styles in... Automatically shifting from header to body text style on ; Having first body paragraph after a header use block format while subsequent paragraphs used indented format... The style editor was always crappy. Most people won't notice due to the lack of comparison. Word processors like Fireworkz and TechWriter got it right to handle layered styles and effects. Easy to edit and easy to apply. And also easy to get rid of them again with a region editor which made it easy to select all modifications that were applied to a text and to delete or modify them. In comparison, MS Word is a mechanical typewriter. Regards, Dietmar -- https://mail.python.org/mailman/listinfo/python-list
Re: Everything good about Python except GUI IDE?
On 28.02.2016 13:52, c...@isbd.net wrote: Dietmar Schwertberger wrote: There were and probably still are better word processors, especially for scientific use. E.g. Latex or reStructuredText, not GUI. I was more thinking of TechWriter on RISC OS. For Windows there are probably similar offerings. Try selling LaTex as standard word processor to a corporate environment. I guarantee you that you will fail. Regards, Dietmar -- https://mail.python.org/mailman/listinfo/python-list
Re: Everything good about Python except GUI IDE?
On 28.02.2016 13:23, Sven R. Kunze wrote: I recently introduced LaTeX to my girlfriend. LaTeX is quite ugly and it has this "distinct compile/execute step", so initially I hesitated to show it to her. But her MS Word experience got worse and worse the more complex (and especially larger) her workload became. Word became less responsive and results became even less reproducible (footnote numbering, styling, literature, etc.). Well, MS Word is a bad example, as it's lacking even some very basic features like a good user interface for styles. (This is the reason why most people are using Word just like a typwriter instead of creating structured documents.) There were and probably still are better word processors, especially for scientific use. The discussion here is not about "any GUI builder", but about a "good and easy to use GUI builder". Regards, Dietmar -- https://mail.python.org/mailman/listinfo/python-list
Re: Everything good about Python except GUI IDE?
On 27.02.2016 19:51, Dietmar Schwertberger wrote: You will find many "Getting started with..." for both PyQt and wxPython. P.S.: I forgot to mention that both toolkits have very helpful mailing lists. The toolkits have different licenses. With wxPython you don't need to worry. For PyQt you should check which versions and licenses of PyQt and Qt are applicable and whether they are OK for your purpose. Regards, Dietmar -- https://mail.python.org/mailman/listinfo/python-list
Re: Everything good about Python except GUI IDE?
On 27.02.2016 19:13, wrong.addres...@gmail.com wrote: I am starting to wonder if VB.net would be a better solution for the time being. I have learnt enough VB.net to manage my work but it is bloated and Microsoft dependent. I would recommend the Python option... I will check it. I got the impression that you can create a GUI but that has to be converted to Python, and then you need a wrapper to put these forms in, and then they can be compiled or converted to *.exe with py2exe. Not a good way for development/debugging. For PyQt with Qt Designer the development flow looks like e.g. https://nikolak.com/pyqt-qt-designer-getting-started/ For non-trivial GUIs you will probably find it easier to create the GUI in Python code yourself. But maybe the created Python code will show you how to use PyQt in the beginning. You will find many "Getting started with..." for both PyQt and wxPython. For either GUI toolkit, you should get a book - either "wxPython in Action" or "Rapid GUI Programming with Python and Qt" (or both). For both toolkits the electronic documentation is not for Python but for C++. For wxPython you get a .chm help file, which contains all documentation in one file and a wxPython demo which contains a browser and example code for almost all GUI components. For PyQt the documentation is online. While it is quite complete, I always have difficulties to find the information I'm looking for... wxPython is currently not really an option for Python 3, but this will change very soon. (Well, it can be used with Python 3 already, but for a beginner I would recommend to start with the so called "classic" version for Python 2, especially as the included demo will be the main source of information.) For debugging you just run the interpreter with the .py file. It's reasonably simple to debug with e.g. WingIDE. When you create a GUI in Python code, it's often the easiest way to explore properties and methods of the GUI classes from the debugger prompt. Regards, Dietmar -- https://mail.python.org/mailman/listinfo/python-list
Re: Everything good about Python except GUI IDE?
On 27.02.2016 12:18, wrong.addres...@gmail.com wrote: Isn't there any good GUI IDE like Visual Basic? I hope there are some less well known GUI IDEs which I did not come across. Thanks. As of today, there's no Python GUI builder comparable to VB 6. There are some like QtDesigner or wxGlade, but they either don't generate Python code directly or they can only be used if you know the underlying toolkit good enough to create the GUI yourself. You may try out some, but I can almost guarantee you that you will come to the same result. If you want a GUI, create it yourself using either wxPython or PyQt. For engineering applications that's probably the weakest point that Python has. It's holding back a lot of people... Well, for most measurement or control software a GUI is not really needed, but still people want it. Regards, Dietmar -- https://mail.python.org/mailman/listinfo/python-list
Re: Considering migrating to Python from Visual Basic 6 for engineering applications
On 18.02.2016 18:49, wrong.addres...@gmail.com wrote: What do I lose by using an external library? With using matplotlib for your plots, you can easily create many kinds of plots. On the other hand, if integration with MS Office is a concern, other options may be more suitable for you as matplotlib can not export EMF/WMF files any more. (Using svg or pdf as intermediate format is possible, but no fun.) With the drawing function of e.g. wxPython or PyQt you can either draw on the screen or into a Metafile context using the same code. So you can easily export high quality vector graphics via clipboard or file. Regards, Dietmar -- https://mail.python.org/mailman/listinfo/python-list
Re: What's the best/neatest way to get Unicode data from a database into a grid cell?
On 07.02.2016 12:19, c...@isbd.net wrote: However my database has quite a lot of Unicode data as there are French (and other) names with accents etc. What's the right way to handle this reasonably neatly? At the moment it traps an error at line 37:- self.SetCellValue(row_num, i, str(cells[i])) The unicode versions of wxPython should have no problems with handling unicode strings. The problem that you see here is that str(...) tries to convert your unicode data into a non-unicode string, which of course fails. Do something like: value = cells[i] if not isinstance(value, basestring): value = str(value) self.SetCellValue(row_num, i, value) Once you switch to Python 3 and Phoenix you have to modify this slightly, e.g. by adding this to the top of your code: try: basestring except: basestring = (bytes,str) Regards, Dietmar -- https://mail.python.org/mailman/listinfo/python-list
Re: wxpython strange behaviour
On 15.01.2016 18:05, Shiva Upreti wrote: Please help me solve these issues. Please decide first on which list or forum you want your questions to be answered. Once people find out that you are asking the same questions all over, the support will soon end. Regards, Dietmar -- https://mail.python.org/mailman/listinfo/python-list
Re: Dabbling in web development
Am 19.11.2015 um 22:53 schrieb bSneddon: I know there are a plethora of web frameworks out there for Python and to be serious about website developement I should learn on like Django. Really thought, I just want to dabble and do some easy stuff. Does anyone have any suggestons? I have a a website hosted with a hosting company who is supposed to have python support but hard to know what they have installed on there apache server. I have seen a few examples out there but not too many. Maybe, you should have a look at the book "Lightweight Django". Regards, Dietmar -- https://mail.python.org/mailman/listinfo/python-list
Re: Python and IDEs [was Re: Python 3 is killing Python]
Am 03.08.2014 02:04, schrieb Gregory Ewing: MRAB wrote: RISC OS didn't have a menu bar at the top of each window either; its menus were all pop-up. You didn't have to keep flicking the mouse at all! The main reason for having a menu bar is discoverability. The idea is that you can browse through the menus and get a feel for what commands are potentially available to you. That's not so easy to do when everything is hidden in contextual menus. This was not a problem with the RISC OS menu concept. Only some menu items were depending on the mouse position. Actually the menu items were easier to discover as the non-applicable items were not hidden but greyed out. Regards, Dietmar -- https://mail.python.org/mailman/listinfo/python-list
Re: Python and IDEs [was Re: Python 3 is killing Python]
Am 01.08.2014 13:10, schrieb Wolfgang Keller: Because on such operating systems, each and every application is an entirely self-contained package that doesn't need any "packages" or "installers" to use it. For people who have never used such a system it's probably difficult to see the advantages. Besides the easy installation, backup and replication of software the RISC OS way also had the advantage that you were able to organize your applications in folders just like other folders and files. There was no need for separate File and Program managers. MS never got this right. Instead, they tried to fix things later with the start menu and finally the box to type the software name to start it ... One effect was that under DOS/Windows people usually saved their documents in folders per application whereas under RISC OS they were usually grouped by content/project. When it came to usability, RISC OS had many advantages over the other systems, e.g. - real drag'n'drop for loading *and* saving of files/selections - drag'n'drop also for transfer between applications - a standard vector graphics format that all applications supported (and for which an application was provided by default with the OS) - good font display (still better than e.g. MS Windows today) - three mouse buttons for select/menu/adjust - no menu bars - the icon bar for running applications, drives, shares and other resources - consistent, orthogonal & logical user interfaces instead of assistants and wizards for each and every task - complete programmers reference manual Regards, Dietmar -- https://mail.python.org/mailman/listinfo/python-list
Re: .Net Like Gui Builder for Python?
Am 26.07.2014 12:25, schrieb Chris Angelico: The only difference is that you outgrow paper sooner than VB, which means porting is done on a much smaller "code"-base and is less of a problem. Most Excel or VB based tools are never replaced. They are the replacement and final implementation of the paper solution already. The world would be a better one if Python was chosen instead of Excel for implementation, offering a continuous path for improvement, but that won't happen without an easy-to-use GUI builder. (Even though many problems could be addressed without a GUI, it's still what people want.) Regards, Dietmar -- https://mail.python.org/mailman/listinfo/python-list
Re: .Net Like Gui Builder for Python?
Am 26.07.2014 11:05, schrieb Chris Angelico: IMO it's an attractive nuisance at best. Make it easy to build something simple and flawed, and people will build things that aren't simple but are still flawed. Microsoft has done this to the world a For most software/tools that's good enough. It's better to have this than having nothing. Sure, when you have a look at the VB-created programs, most of them are flawed, but still they solve problems. Currently, Python is ruled out as tool in many situations due to the steep learning curve when it comes to GUIs, so people use Excel, Labview, Matlab or whatever (or nothing at all or still VB). But for building a large and complex application, they tend more to make the job harder than easier; and for people who've learned on that system Most problems that are out there to be adressed require only simple applications. For anything non-trivial I don't see that a GUI-builder, I agree that hand-coding the GUI is the better approach. But then, we're now in a world where e.g. Qt is moving away from widgets to QML which makes GUI programming a huge mess (in the same way that PHP made web-programming a mess). and no other, it's "but this works - what, I have to learn a whole new system now? That new system sucks". What is the point of not having tools to ease the entry? Of course it makes the others, who still learned it, feel cool, but other than that? Regards, Dietmar -- https://mail.python.org/mailman/listinfo/python-list
Re: .Net Like Gui Builder for Python?
Am 25.07.2014 16:55, schrieb Orochi: So,Is there any Gui App builder like Visual Studio or having features like Visual Studio for Python. Unfortunately there's nothing like that. IMHO the lack of such a tool is a major blocking point in many (corporate) environments... From the GUI builders that I have tried, wxFormBuilder comes next. Regards, Dietmar -- https://mail.python.org/mailman/listinfo/python-list
Re: Excel column 256 limit
Am 18.03.2013 16:28, schrieb Ana Dionísio: Is there some way to go around this limit? I need to import data from python to excel and I need 1440 columns for that. There are many versions of Excel. The recent ones can handle more than 256 columns. If your version doesn't, then Python won't help you to increase this limit... There are many ways to get data from Python into Excel. If you have any specific problems, you should provide more details. Regards, Dietmar -- http://mail.python.org/mailman/listinfo/python-list
Re: Is there a graphical GUI builder?
Am 19.02.2013 23:19, schrieb Rex Macey: I'm new to Python and only a hobbyist programmer. A long time ago I used Microsoft's Visual Basic which had a nice (graphical) facility for creating GUIs which was part of the development environment. There are GUI builders, but unfortunately there's none which is as easy to use as VB where the GUI builder and the rest of the programming environment / language are tightly integrated. Have a look at the GUI toolkits wxPython and PyQt. Then have a look at the GUI builders like Qt Designer, wxFormBuilder and wxGlade. Maybe also wxDesigner. For the builder itself, you will probably like Qt Designer most. But as with the other GUI builders, it generates resource files or Python source code which then you will need to import into your Python project and manually link GUI and code. Compared to the VB way, this is a huge step backwards and also this means that you need to know and remember a lot about the underlying toolkit. You will probably end up coding your GUIs manually, which is the best way for complex things anyway. Unfortunately, that's a blocking point for many usage scenarios, e.g. when you want to sell Python as replacement for VB... Regards, Dietmar -- http://mail.python.org/mailman/listinfo/python-list
Re: Pythonic cross-platform GUI desingers à la Interface Builder (Re: what gui designer is everyone using)
Am 13.06.2012 18:30, schrieb rdst...@mac.com: about Google's "Blockly" a drag and drop tool for building apps that outputs Python or Javascript code (among others) and it might be usable along these lines...I'm sure serious programmers would not use it but maybe engineers looking to make web front ends for data acquisition or data base apps might use it... Actually, there are mouse based tools for engineers, but they are more focused on data flow. For the low level they need to fall back to something similar to Blockly. That's the reason why I don't want to use them. Still they have a significant market share. With Python not having an easy-to-use GUI builder, I don't see how to get people to move from such tools to Python. For the data acquisition and processing itself I could well imagine them to see the potential, but when it comes to implementation of a complete program... (Most people consider a software without GUI as incomplete.) Regards, Dietmar -- http://mail.python.org/mailman/listinfo/python-list
Re: Pythonic cross-platform GUI desingers à la Interface Builder (Re: what gui designer is everyone using)
Am 15.06.2012 01:07, schrieb Dennis Lee Bieber: Visual Basic was essentially developed as a unified whole (drop a Sure. I prefer modular approaches. I don't see why this should not be possible (e.g. an IDE like Wing integrates well with other tools and frameworks; I'm sure it could also integrate with a GUI builder). VB6 "form" module into a pure text editor and look at how much hidden code was embedded)... I did so several times before. It's nothing that you want to create manually, but you can fix small items there and also, being text based, it works with revision control systems and can be printed for documentation purposes. Have you ever seen the crud created by Visual C++? I'd rather create No. And I don't have plans to. C/C++ is good as a system-level language but I don't see the point in using it for implementation of a GUI or business logic. a GUI using Fujitsu COBOL version 4 (unfortunately, the installer that came with my Y2K COBOL book(s) doesn't work on WinXP and I no longer have a Win98 system; wonder if it can run under Win7 using one of the compatibility modes; I think v4 itself would work -- it is just the installer doing something odd; v3, OTOH, is a 16-bit application) If you have access to a Win98 system, you could try to install there an move only the installed program to your current PC (including any DLLs from the system folder). Well-written software does not need an installer. Just move where you want to have it and execute (works well with Python; you can e.g. run a shared installation from the network, even though I would not recommend this for processes requiring highest reliability). IMHO under Windows installers and the crappy start menus are a side effect of the initial decision to separate into File Manager and Program Manager. Other platforms did things better from a UI and technical point of view, but not from a commercial one... (E.g. Acorn's RISC OS where you could even run software from within zip archives as it had the equivalent of user-space file systems twenty years ago already.) Regards, Dietmar -- http://mail.python.org/mailman/listinfo/python-list
Re: Pythonic cross-platform GUI desingers à la Interface Builder (Re: what gui designer is everyone using)
Am 13.06.2012 14:49, schrieb Wolfgang Keller: No matter how cool it may seem to create simple GUIs manually or to write business letters using LaTeX: just try to persuade people to move from Word to LaTeX for business letters... Good example. I have done nearly exactly this* - but it was only possible thanks to LyX. *I moved not from Wugh, but from other software to LyX/LaTeX for all my document processing. But of course, you were only doing so because you had LyX available, which is the equivalent of an easy-to-use GUI builder. So maybe I should be more precise: just try to persuade people to move from Word to *pure* LaTeX for business letters... Regards, Dietmar -- http://mail.python.org/mailman/listinfo/python-list
Re: Pythonic cross-platform GUI desingers ?? la Interface Builder (Re: what gui designer is everyone using)
Am 14.06.2012 23:29, schrieb Grant Edwards: On 2012-06-14, Dietmar Schwertberger wrote: Yes, sorry. I posted that too late in the night. The point was that there's no easy-to-use GUI builder which would allow the casual user to create a GUI. I'm not sure I'm in favor of casual users creating GUIs. Have you ever tried to _use_ a program built by a casual user? [OK, I'm half joking.] I understand your point. I've used and fixed many such programs. Plenty of those were by so-called professionals. Usually, those are the most problematic cases as you don't have the sources available or they are developed and deployed by a central IT department. There's a correlation between technical knowledge of creating a GUI and the quality of the resulting GUI, but the correlation is not too strong. The casual programmer that I was refering to, is also among the users of the software that (s)he is writing and therefore the GUI tends to be improved over time, which often is not the case with the software developed by so-called professionals who get paid for the program and then move on. The point is, that if you want to promote Python as replacement for e.g. VB, Labview etc., then an easy-to-use GUI builder is required. The typical GUI programs will just have an input mask, a button and one or two output fields. Regards, Dietmar -- http://mail.python.org/mailman/listinfo/python-list
Re: Pythonic cross-platform GUI desingers à la Interface Builder (Re: what gui designer is everyone using)
Am 14.06.2012 22:06, schrieb Colin Higwell: On Tue, 12 Jun 2012 00:55:38 +0200, Dietmar Schwertberger wrote: As long as there's no GUI builder for Python, most people will stick to Excel / VBA / VB. No GUI builder for Python? There are plenty. Yes, sorry. I posted that too late in the night. The point was that there's no easy-to-use GUI builder which would allow the casual user to create a GUI. I use wxGlade with wxPython and it works beautifully. It writes the code for the GUI elements, and I put in the event handlers, database access code and so on. Yes, from the ones I've tested, wxGlade came closest to what I was looking for. But still, it's far away from being the tool that is required IMHO. (An it does not seem to be in active development.) Also, with wxGlade you are forced to use sizers - even at positions where they are not useful at all. For simple GUIs that adds a level of complexity which is counter productive. (From the GUI editors that I tried, Qt Creator/Designer was the only one where I agree that it handles sizers/layout containers well.) When I compare e.g. wxGlade to VB6, whether a casual programmer can use it to create a GUI, then still VB6 wins. VB is crap, but at least it allows to create GUIs by using a GUI and will help you getting started in writing GUI applications. It will take only a few minutes to teach someone how to get started. On the other hand, I need to know wx very well to be able to create a GUI using wxGlade as otherwise I will never find where to add e.g. the handlers. But when I know wx very well, then there's no point in using wxGlade. Regards, Dietmar -- http://mail.python.org/mailman/listinfo/python-list
Re: Pythonic cross-platform GUI desingers à la Interface Builder (Re: what gui designer is everyone using)
Am 11.06.2012 01:15, schrieb Chris Angelico: If you're a complete non-programmer, then of course that's an opaque block of text. But to a programmer, it ought to be fairly readable - Well, I can read the code. But still I would not be able (or interested) to write C++/GTK code. With my rusty C++ knowledge and a simple GUI builder, I might be able to create the GUI, though. Whether I could then connect the events to actions is a different question and depends on the GUI builder. If it does not support this, then I would just not write the software. That's the starting point of this thread: for Python we could not identify such a GUI editor. it says what it does. I'm confident that anyone who's built a GUI should be able to figure out what that's going to create, even if you've never used GTK before. (And yes, it's not Python. Sorry. I don't have a Python example handy.) All the discussion about casual users being able to implement GUIs by manually coding it is somehow based on the assumption that suitable examples for any purpose are available. So to me the above example seems to be the proof that suitable examples are not available easily. Modern UI toolkits are generally not that difficult to use. Add just a few convenience functions (you'll see a call to a "button" function in the above code - it creates a GTK2.Button, sets it up, and returns it), and make a nice, well-commented configuration file that just happens to be executed as Python, and you've made it pretty possible for a non-programmer to knock together a GUI. They'll have learned to write code without, perhaps, even realizing it. Right, they are not too difficult to use for full-time programmers or for people who want to invest a lot of time (as hobbyist). But there are many people who just need to get things done and who don't want to invest too many time on a simple GUI. No matter how cool it may seem to create simple GUIs manually or to write business letters using LaTeX: just try to persuade people to move from Word to LaTeX for business letters... Regards, Dietmar -- http://mail.python.org/mailman/listinfo/python-list
Re: Pythonic cross-platform GUI desingers à la Interface Builder (Re: what gui designer is everyone using)
Am 11.06.2012 16:09, schrieb Mark Roseman: > On the Tkinter front, I just want to reiterate two important points that > are not nearly as well known as they should be. > > First, it is possible and in fact easy to do decent looking GUI's in > Tkinter, with the caveat that you do in fact have to do things very > slightly differently than you would have 15 years ago. Shocking, I know. Yes, but when I have the choice between Tkinter, Qt and wx, I still would go for wx or Qt (or stick to wx which I chose 12 years ago). I don't see the point of chosing Tkinter over the other toolkits. > Second, there does exist at least one fairly good source of > documentation for new users wishing to do exactly this (according to > many, many comments I have received), though that documentation is > admittedly buried in a sea of out-of-date information that is still all > too easy to find. > > Please see http://www.tkdocs.com and in particular the tutorial there. The point of this thread is that Python is not attractive to casual users who want to implement some GUI programs. I don't see how that would change without an easy-to-use GUI builder, no matter how good the documentation is. Of course, it's possible to split up the documentation into many small building blocks which the user could copy & paste together. But then we have a poor-man's GUI builder. I doubt that it would attract new users. (For more straightforward tasks like hardware control / data acquisition I made good experiences with a Wiki-based approach of providing snippets. But *simple* GUIs are mainly visual and there should be a way to create them visually without consulting much documentation.) Regards, Dietmar -- http://mail.python.org/mailman/listinfo/python-list
Re: Pythonic cross-platform GUI desingers à la Interface Builder (Re: what gui designer is everyone using)
Am 11.06.2012 16:14, schrieb Anssi Saari: Wolfgang Keller writes: This whole cycle of "design GUI"->"generate code"->add own code to generated code"->"run application with GUI" has always seemed very un-pythonic to me. A dynamic, interpreted language should allow to work in a more "lively", "direct" way to build a GUI. What about Qt Quick? I have used it very little, but it does allow dynamic modification of the GUI elements so that the application changes on the fly. I don't know how pythonic it is, since the GUI is described in QML, which combines CSS and javascript. I have been following the Qt development as I have been using PySide for some small projects on the Maemo platform. Qt Quick / QML seems to enable the implementation of so-called "modern" UIs. It's more for people who think that HTML5/CSS/Javascript is the future for UIs. Well, maybe they are right for certain advanced requirements. But for the beginner I don't see how it would help as it's even more difficult to link the GUI to the backend code and also I don't see how having to deal with multiple environments would make things easier. I think that for beginners some basic controls are fine enough and there's no need to care for fancy effects for the most non-consumer applications. For getting an impression about Qt Quick, have a look at http://qt.nokia.com/qtquick/ (The slide show 1,2,3,...) Regards, Dietmar -- http://mail.python.org/mailman/listinfo/python-list
Re: Pythonic cross-platform GUI desingers à la Interface Builder (Re: what gui designer is everyone using)
Am 11.06.2012 14:01, schrieb Wolfgang Keller: * Domain experts in fact who would need to implement loads of software to help them get their work done but can't. And since there's no budget for external developers, nothing get's ever done about this. Well, typically or at least very often sooner or later something gets done about this as someone finds out that all could be solved using MS Excel and some macros / VBA programming. I would prefer people to invest the same time into a Python based solution. But then we're back to the initial point: As long as there's no GUI builder for Python, most people will stick to Excel / VBA / VB. Regards, Dietmar -- http://mail.python.org/mailman/listinfo/python-list
Re: Pythonic cross-platform GUI desingers à la Interface Builder (Re: what gui designer is everyone using)
Am 11.06.2012 06:05, schrieb rusi: If python is really a "language maven's" language then it does not do very well: - its not as object-oriented as Ruby (or other arcana like Eiffel) - its not as functional as Haskell - its not as integrable as Lua - its not as close-to-bare-metal as C - etc Depends on the definition. Maybe, that Python is not a perfect language from an academic point of view, but it's a good choice for anyone looking for a pragmatic programming language. Then why is it up-there among our most popular languages? Because of the 'batteries included.' It's not only the batteries, but also the language itself. As someone wrote a long time ago "Python fits my brain". And not having a good gui-builder is a battery (cell?) that is lacking. It's a cell that would make it much easier to compete with other languages/environments. These environments need not necessarily be classical programming language, but could also be Labview, Matlab etc. And regarding popularity, I see very much potential. I have been working for two high-tech companies and I have never met anyone else using Python there. Focus is not classical databases, but data acquisition and processing. Many are still using VB, some are even using HT/HP-BASIC. Quite a lot moved to Labview, some are using Matlab or thinking about moving to it. The ones who actually see the point the advantages of a general purpose language moved to C#. (Nobody is using Java in this context as it obviously would not make any sense.) Anyway, I don't see how people could be persuaded to use a console-only environment, which - realistically - Python is at the moment for most people. From what I see, Python is recognized as a language for scripting and maybe for web servers, but not as a general purpose language to implement GUI software. (To make it clear: I have been using Python as a general purpose language for many years.) Regards, Dietmar -- http://mail.python.org/mailman/listinfo/python-list
Re: Pythonic cross-platform GUI desingers à la Interface Builder (Re: what gui designer is everyone using)
Am 10.06.2012 21:36, schrieb Rick Johnson: It is possible. Try Tkinter for the "get-you-from-a-to-b" solution, or, wxPython if you like fog lamps, heated seats, and navigation systems. I prefer wx or Qt. The look and feel is one reason. But the fact that Tkinter is still the standard GUI toolkit tells a lot about the situation... Buttons and feilds are just a few short lines of code. Look. You guys don't need a visual GUI builder. What you need to do is stop being > lazy and spend a few hours studing the basics of Tkinter and wxPyhon > (or whatever else suits your needs). IMO, every single python > programmer who needs GUI interfaces should know the basics of AT LEAST > Tkinter without even looking at the docs. I mean, how difficult is: [snipped code examples] Sure, I know how to code GUIs. But the learning curve is too steep for new users wanting to implement simple GUIs. With Tkinter you add a GUI element IN THE CODE and then you are ALREADY in the code editor! What an amazing concept! No juggling editors and windows. No need to mentally switch from one language to another. Can you imagine how productive you could be? I thought about preparing some templates for typcial applications, but I abandonded this as I don't think that it would work out well. If you have not used VB before, you should just try it. You can create GUIs within a few minutes even if you haven't used it before. Allow me to qualify that very naive generalization: "ANYBODY and point and click, very few can actually write code". Right. I won't comment on the quality of the most VB code. But there are many applications where the quality of the code is not the main objective. It just needs to work e.g. to set up the instrument and read back data. The know-how and value is not the GUI code, but in the instrument setup and data evaluation. I say. If your GUI kit gives you the feeling that you are writing too much boilerplate, well, then, it's time to wrap up some re-usable functionality on your own. I have done this myself with Tkinter AND Wx. ( although much more so with Tkinter being that is a poorly designed GUI) Did the same for wx twelve years ago as I did not like e.g. the event handling. Most of the time I'm still using my own wrappers. Still, once or twice a year I'm writing some small applications where I would use a GUI builder if it was available instead of copying old code as template. I can teach anyone how to create a program for data acquisition, but I don't see how more than a few could create a GUI without an easy-to-use tool. Like Tkinter? Don't like Tkinter, even though the alternatives are not too Pythonic either. Visual Basic sucks. I spend more time re-focusing my mental energy than actually getting work done. There is no replacement for pure raw code. You visualize GUI's in you mind, and fingers bring that vision to life through properly written API's. Never invent a new problem for a solution that does not exist. Sure, VB language sucks, but still I do not see any other tool that would cover the RAD aspect of the VB 6 environment. I would love to see Python for this, even though this would have negative side effects (e.g. attracting stupid people like PHP seems to). Regards, Dietmar -- http://mail.python.org/mailman/listinfo/python-list
Re: Pythonic cross-platform GUI desingers à la Interface Builder (Re: what gui designer is everyone using)
(Sorry for posting without references to the previous messages, but it seems that many messages don't get through to the nntp server that I'm using.) Chris Angelico wrote (in two posts): > There was a time when that was a highly advertisable feature - "build > XYZ applications without writing a single line of code!". I've seen it > in database front-end builders as well as GUI tools, same thing. But > those sorts of tools tend not to be what experts want to use. You end > up having to un-learn the "easy way" before you learn the "hard way" > that lets you do everything. This time is not over. Especially when you look at data acquisition and control applications where tools like Labview are widely used. Personally, I would not want to use such tools as I find it quite complicated to implement any logic with a graphical editor. But when you want to sell an alternative to such tools, then you should not offer a tool which makes it almost impossible for a typical engineer to create a simple GUI. > You refer to "non-programmers" and then point out that they would be > lost trying to add code. That's a natural consequence of not being a > programmer, Sure, but with "non-programmers" I'm referring to typical engineers who can implement some basic programs for measurement, control or data processing. > and of all languages to help someone bridge that gap and > start coding, I would say Python is, if not the absolute best, > certainly up there somewhere. Just as you wouldn't expect a music 100% agreed. It's the only programming language that I can recommend to casual or even non-programmers, but only as long as he/she's not interested in GUI programming. > authoring program to let someone publish score without knowing how to > compose music, you can't expect a GUI tool to relieve you of the need > to write code. The audience of GUI editors is not the artist / professional... > WYSIWYG UI designers suffer badly from a need to guess _why_ the human > did what s/he did. Build your UI manually, and there's no guesswork - > you explicitly _tell_ the computer what to do and why. True for non-trivial applications. I don't have many windows and dialogs that could have been created using a GUI editor in my main wxPython based application. But even then: I've learned wxPython from looking at the code that wxDesigner created. Of course, that was in 1999/2000 when no books on such matters were available. > There's an assumption in most of the Windows world that everything > needs a GUI. For a simple data acquisition program, I wouldn't use one > - I'd have it run in a console. That's something that any programmer > should be able to create without studying complex manuals; all you > need to know is the basics of I/O and possibly argument parsing. Yes, usually I'm using a console as most measurement programs are quite straighforward and linear. But I don't see a way to convince people to go back to the console. They will always want to implement a basic GUI for one or the other program and then they will end up frustrated... (Or I have to implement the GUI for them, which is not an option.) > I've used Visual Basic. My first salaried work was on VB. Making it > easy to throw together a simple GUI doesn't mean a thing when you have > a large project to write - your business logic and UI design work will I would never consider or recommend to write anything significant using a GUI builder. Also, I would never recommend anyone to use VB at all. But given the lack of alternatives, it still has a significant market share. (The fact that anyone can hack together a program in VB has the side- effect that most programs are not very good...) > massively dwarf the effort of actually throwing widgets into a > hierarchy. So the only time it's going to be an issue is with trivial > programs; which means there isn't much to be saved. Just make your > trivial things run in a console, and then either use a GUI builder > (several have been mentioned) or hand-write your UI code. Right, we're talking about non-trivial programs with almost trivial user interfaces. But I don't see a Python GUI builder which a casual user could use to add a GUI to the code. (To be exact: it's easy to create a GUI with one or the other builder, but non-trivial to connect it to the backend.) > Actually, there's a third option these days. Give it no console and no > GUI, make it respond to HTTP connections, and use a web browser as > your UI. :) I don't think that this is easier for the casual user as multiple languages and environments are involved. But on the other hand there are some (mainly commercial) organizations who believe that HTML5, CSS and Javascript are the future for GUI programming. Personally, I prefer Python with console, wx or Qt for local applications and Python/HTTP/HTML/Javascript for multi-user database applications. Regards, Dietmar -- http://mail.python.org/mailman/listinfo/python-list
Re: Pythonic cross-platform GUI desingers à la Interface Builder (Re: what gui designer is everyone using)
Am 10.06.2012 08:16, schrieb rusi: This is worth a read in this context: http://osteele.com/archives/2004/11/ides So which language would you suggest to use next? ;-) I've read the article. It presents some nice ideas, but probably the author has not used Python before. Otherwise he would have noticed that the overall productivity does not only depend on language and IDE/editor, but on the complete environment which in the case of Python includes the ability to use the interpreter interactively. For many tasks that's a major productivity boost. But that's a point that many people don't see because their current language like C# or Java does not have an interpreter and when they just look at the syntax, the find "there's not enough improvement to switch". Also, I'm not sure whether the author counts the libraries as language or tool feature. In my opinion the environment and the libraries should be listed on their own in such an article. Libraries are developed after the language, but usually they are ahead of the other tools/IDEs. The author lists many IDE features that I personally don't find too important (the refactoring capabilities of a simple text editor are fine for me...). But following the link to Laszlo made the reason quite clear because his IDE background is from Eclipse not from Python. Btw.: I've been using Python for 16 or 17 years now. Only 3 years ago I did the switch from Editor to IDE (Wing IDE) and this has brought a *significant* boost of productivity (especially the good debugger allows you to code in a different way as you can use the interactive interpreter at any point in your program). But back to my original point, this time in the context of the article: If you want to 'sell' a programming language for corporate use, you absolutely need the tools. And this includes an easy-to-use GUI editor which does not only allow to create the GUI, but also to fill it with code. Most corporate users are casual users, not full time programmers. Regards, Dietmar -- http://mail.python.org/mailman/listinfo/python-list
Re: Pythonic cross-platform GUI desingers à la Interface Builder (Re: what gui designer is everyone using)
Am 09.06.2012 17:34, schrieb CM: You can do this for wxPython with Boa Constructor easily. You can bind an event handler for a wx.EVT_BUTTON to, e.g., "Button1" with Boa and it will add this code for you to the bottom of your code: def OnButton1Button(self,evt): evt.Skip() And you can than go in the code editor to that function and change the code to do whatever you want. Having to go there is already more work than I would expect. I would expect to go there e.g. by a double-click. This is just a minor point, but many minor points sum up... If you take maybe 10 people each with some BASIC or Python knowledge, I would bet that you can teach most of them how to write a simple GUI program in VB within five minutes, but you'll probably fail with Boa. (And even then you would have to re-teach them in a few months when they try to write their next program.) If you have not used VB before, you should just try it. You can create GUIs within a few minutes even if you haven't used it before. Same with Boa. Not for me when I tried Boa. The logic / usage concept behind is not exactly straightforward. At the time, Boa was suggested to be the perfect choice for previous Delphi users. Maybe my problem was that I did never use Delphi. (Only Turbo Pascal in the pre-gui era...) Such an editor should support simple manual layouts without enforcing the use of sizers (wx) or layout managers (Qt). These add an additional level of complexity which is not required for simple GUIs. Same with Boa, though it also has good support for sizers which generally should be required for anything other than the simplest GUIs. Yes, at least Boa left the choice to the user. Some of the other tools even insist on sizers at places where they are not even required with a sizer-based layout. (E.g. with wx you usually place a notebook directly on a frame while some tools insist on using a sizer first.) In addition to Boa, I get the sense that the other tools mentioned here are also good, so is this "blocking point" real? I've tried several: wxDesigner, Boa, QtCreator, wxFormBuilder, wxGlade, None of these were such that I could propagate it as GUI development tool for non-programmers / casual users. Sure, some are good for designing the GUI, but at the point where the user code is to be added, most people would be lost. (I think that was the point that Wolfgang did not like and did describe as un-pythonic.) Also, another requirement for this purpose would be that the tool is under active development. This would e.g. rule out Boa. I would not care whether the tool is freeware or commercial. Being freeware would make handling easier, though (e.g. deployment to all measurement PCs by just running it from a file share is easier than local installations and license handling). Regards, Dietmar -- http://mail.python.org/mailman/listinfo/python-list
Re: Pythonic cross-platform GUI desingers à la Interface Builder (Re: what gui designer is everyone using)
Am 08.06.2012 17:11, schrieb CM: I'm curious about your point but I don't really understand it. Could you try again without using any scare-quoted words? Maybe given an example of creating a small text editor application with a GUI builder/ IDE in this Pythonic way you are hoping for. Before anyone now writes "Good GUIs are coded by hand": I agree, but for many purposes only simple GUIs are required and it should be possible to create these without studying manuals (on toolkit and GUI editor). A typical simple GUI would e.g. be for a measurement / data aquisition program, where you just need some buttons and fields. I think that something in the style of Visual BASIC (version 6) is required for either wxPython or PyQt/PySide (or both). In the Visual BASIC editor you can e.g. add a GUI element and directly go to the code editor to fill methods (e.g. an OnClick method). If you have not used VB before, you should just try it. You can create GUIs within a few minutes even if you haven't used it before. (Sure, the fact that anyone can use it has the side effect that most of these GUIs are not good...) Also: Such an editor should support simple manual layouts without enforcing the use of sizers (wx) or layout managers (Qt). These add an additional level of complexity which is not required for simple GUIs. Background: I'm using Python in a corporate environment but I'm more or less the only one using it. I could propagate Python for wider use as it is the best available language for things like hardware control and data acquisition, but the lack of an easy-to-use GUI editor is the blocking point. I can teach anyone how to create a program for data acquisition, but I don't see how more than a few could create a GUI without an easy-to-use tool. There's still a lot of VB6 code around as there's no replacement and this gap could well be filled by Python. Regards, Dietmar -- http://mail.python.org/mailman/listinfo/python-list
Re: PyUSB available for current versions of Windows?
Am 09.03.2012 18:18, schrieb John Nagle: I want to enumerate the available USB devices. All I really need is the serial number of the USB devices available to PySerial. (When you plug in a USB device on Windows, it's assigned the next available COM port number. On a reboot, the numbers are reassigned. So if you have multiple USB serial ports, there's a problem.) You can get the required information using Windows Management Instrumentation (WMI). See e.g. here for serial port information: http://www.activexperts.com/admin/scripts/wmi/python/0358/ I'm using code like this to find my USB CDC devices from the device description: import win32com.client strComputer = "." objWMIService = win32com.client.Dispatch("WbemScripting.SWbemLocator") objSWbemServices = objWMIService.ConnectServer(strComputer,"root\cimv2") colItems = objSWbemServices.ExecQuery("SELECT Description,DeviceID FROM Win32_SerialPort") COM_ports = [] for objItem in colItems: print objItem.Description,objItem.DeviceID if objItem.Description == "USB CDC Simple IO HC9S08JSxx": COM_ports.append( objItem.DeviceID ) On some PCs the query took some seconds. Regards, Dietmar -- http://mail.python.org/mailman/listinfo/python-list
Re: convert perl-script for voltcraft voltmeter to python [newbie]
Am 03.02.2012 14:11, schrieb Jean Dupont: As my request might have been too much asked, I have started doing some coding myself. I'm in doubt about the readline statement -which doesn't show anything received- as the meter sends continuously streams of 11 bytes Is there a way to just monitor with python what is arriving at a serial port? Some time ago I started working on reading data from a VC940. I would assume that the protocol is the same. Please find below the code that will return the raw values from a VC940 (tested on a classical RS232 port, but probably will work on USB-RS232 converters as well). If you don't get anything, then you should check whether your USB converter is supplying voltage on the DTR pin once you have called self.serial.setDTR(1). You have the description how to decode the values? E.g. the string "0003:1401" translates to 0.3 Ohms. I did not implement anything else, as I just wanted to be sure that I could read the values, but I never needed to... Regards, Dietmar import serial import time class VC940(object): def __init__(self, port="COM3"): self.port = port self.serial=serial.Serial(port,2400, bytesize=7, parity="N", stopbits=1, timeout=1.5, xonxoff=0, rtscts=0, dsrdtr=None) self.serial.setRTS(0) self.serial.setDTR(0) def _read_raw_value(self): timeout = True for n in range(5): self.serial.flushInput() self.serial.setDTR(1) data = self.serial.read(11) self.serial.setDTR(0) if data.endswith("\r\n") and len(data)==11: return data if not data: raise ValueError, "communication timeout" raise ValueError, "could not read data from port" if __name__=="__main__": vc = VC940() while True: print vc._read_raw_value() -- http://mail.python.org/mailman/listinfo/python-list
Re: Data acquisition
Am 26.10.2011 17:58, schrieb spintronic: Thank you for the discussion. It was really helpful. As mentioned, it was necessary to have a longer delay. Previously I have used a delay of 5 and 10 s but it was not long enough. Now it is 25 s and everything works fine. If you use the correct sequence of trigger and OPC/WAIT, I'm sure you can reduce the waiting time to the required minimum time and still your script will be more robust... Regards, Dietmar -- http://mail.python.org/mailman/listinfo/python-list
Re: Data acquisition
Am 25.10.2011 19:22, schrieb spintronic: On Oct 25, 6:29 pm, Nick Dokos wrote: Shot in the dark: could it be that you have to add delays to give the instrument time to adjust? When you do it from the python shell, line by line, there is a long delay between one line and the next. Thanks! You are right but it was the first thing I thought about. So I have tried to delay using sleep(t) from the time module (I also sent "*OPC?" or "*WAI" commands to a device for synchronization). However, it does not help ... RST is resetting all data and CALC is somehow calculating and returning data. Without a trigger between RST and CALC, I would not expect any data... Maybe the equipment is triggering continuously e.g. every second. When you were using the shell, you had a good chance to see a trigger between RST and CALC. With a script, it's not so likely. OPC won't help, as it would wait for completion of a measurement, but if you don't trigger, it won't wait. What kind of instrument are you using? Check for the trigger command. It may be something like INIT:IMM Regards, Dietmar -- http://mail.python.org/mailman/listinfo/python-list
Re: Development tools and practices for Pythonistas
Am 02.05.2011 01:33, schrieb David Boddie: After noting the warnings it contains, see the following page for a description of the Python API for Mercurial: http://mercurial.selenic.com/wiki/MercurialApi Ah, yes, no need to use os.sytem(), but all in all not much difference from doing so (and usage of CLI is recommended instead of using the API). I had a look at this page in 2009 and came to the conclusion that it's no good idea to use Mercurial as library. Seems that this still holds true. Git also has a Python API, which is fairly reasonable to use, though a bit different to the Mercurial one: http://www.samba.org/~jelmer/dulwich/ That looks more promising to me. I think I will try this and Bazaar to find which fits my needs better. Regards, Dietmar -- http://mail.python.org/mailman/listinfo/python-list
Re: Development tools and practices for Pythonistas
Am 01.05.2011 02:47, schrieb Shawn Milochik: Look at the big two sites for open-source repositories -- github and bitbucket. One's git, the other Mercurial. I don't think you can go wrong picking either one. Can any of those be used from Python as a library, i.e. something like import Hg r = Hg.open(path) When I had a look at Mercurial, which is implemented in Python, it was implemented in a way that I could not do that. It was implemented as rather monolithic program which could be used from os.system(...) only. With a good API, I could easily have integrated it into my development flow. I have a codebase which is shared between different projects and there are many small changes on many different PCs. In theory a distributed VCS is good at supporting that, but in practice I went back to my lightweight synchronization scripts and file storage again. With the API, I could have best of both worlds. Regards, Dietmar -- http://mail.python.org/mailman/listinfo/python-list
Re: Organization of GUIs
Michael Mossey schrieb: View can be fine-grained. Often the View consists of a number of GUI objects. Some people write this in a democratic arrangement---they all talk to each other. This can make analyzing system behavior complicated. Hence my proposal for a hierarchy. Yes, the democratic arrangement is only for very simple applications. Also, often different parts of the Model talk to different parts of the View. The question, then, is whether both the Model and View should be structured hierarchically so that all messages pass through a "master" or "root" object before going to the other Model/View, and messages within a Model or View should only move along the hierarchy. In other words, you can easily make a complete mess of MVC. I made good experiences with this setup in a very complex application (inspired by MVC/MVP, but slightly different): - Model is completely independent of any GUI; in fact it's written to be used not only with a GUI, but also by scripts and an application server - Controller/Presenter holds the model instance and serves as message dispatcher; also it holds view-only data (e.g. cursor position, cell selections, file modified?) - Views/Controls - subscribe to the messages to update themselves - either modify data and send update message via the dispatcher - or tell Controller to modify the data, which then generates the update message With this architecture, you have the choice whether to plug the Views/Controls directly to the Controller/Presenter or organize them hierarchically. I doubt that you'll have many hierarchy levels between Presenter and Controls. Probably only one... Examples for the messages: - "Changed", model (anything may have changed) - "AttributeChanged", attname, value - "DataChanged", index, new_value - "Saved", filename - "Modified", modified - "IndexChanged", new_index - "ViewChanged", view_names (I'm using a tabbed interface and some views react to messages only when they're active.) - "ConfigRead", key, value, persistent Some messages are automatically issued by the Presenter in response to other messages. E.g. for a "Saved" message, the Presenter automatically generates a ("Modified",False) message afterwards. In my case, the model is hierarchical and so I have "Changed" messages for many different aspects / levels. The total number of message types is around 60. I could live with much less, but the finer the messages, the less performance overhead. As there are messages related to the model (e.g. Changed) as well as messages related to the views (e.g. IndexChanged) and to general functionality (e.g. ConfigRead) it's very easy to couple all controls and components via the Presenter. The app is built with wxPython and includes a shell window which exposes some objects including the app itself and the model. In this shell you may manipulate the model interactively or by loading a Python script. For the GUI to catch up you need to issue a "Changed" message afterwards. It would be possible to follow e.g. the original MVP and do all modifications (GUI and shell) via the Presenter to avoid the requirement of issuing this message, but that would require wrapping of much functionality and usage would be less elegant. As the app, including all menu items, is available from the shell, this can also be used for automatic testing. E.g. shell input or script may look like that: >>> filename = "c:\\test.dat" >>> self.menu.file.open( filename=filename ) >>> # or self.menu.file.open() to let the user select a file >>> # or model = ModelModule.open( filename ) >>> if model.filename!=filename: raise ValueError, "test failed" >>> new_filename = "c:\\output.dat" >>> model.filename = new_filename >>> presenter.notify("AttributeChanged", "filename", new_filename) >>> # or presenter.set_filename( new_filename ) >>> # or presenter() as shortcut for presenter.notify("Changed", model) >>> # or presenter.save( new_filename ) Also, it's possible to automatically test dialogs... Regards, Dietmar -- http://mail.python.org/mailman/listinfo/python-list
Re: Help in wxpython
On Wed, 2009-12-02 at 00:20 -0800, madhura vadvalkar wrote: def InitBuffer(self): size=self.GetClientSize() self.Buffer=wx.EmptyBitmap(size.width,size.height) dc=wx.BufferedDC(None,self.buffer) dc.SetBackground(wx.Brush(self.GetBackgroundColour())) dc.Clear() self.Drawcircle(dc) self.reInitBuffer=False I am getting the following error: Traceback (most recent call last): File "C:/Python26/circle.py", line 42, in frame=SketchFrame(None) File "C:/Python26/circle.py", line 38, in __init__ self.sketch = SketchWindow(self, -1) File "C:/Python26/circle.py", line 12, in __init__ self.InitBuffer() File "C:/Python26/circle.py", line 19, in InitBuffer dc=wx.BufferedDC(None,self.buffer) AttributeError: 'SketchWindow' object has no attribute 'buffer' Please tell me what I am doing wrong. As the traceback suggests, self.buffer does not exist. You need to write self.Buffer. I did not have a further look or try the code. Did you have a look at the wxPython demo? The demo "Core Windows/Controls -> ScrolledWindow" is probably very similar to what you want. Krishnakant schrieb: Madhura, Sorry to be a bit off-topic, but, I would really recommend you to use pygtk instead of wx. For one thing, the developers at pygtk are very active (they have their mailing list as well ) and it comes by default with python on almost all linux distros. You can also easily install it on windows. Most important, the api for pygtk is closely similar to wx. Not to mention the quick responses you will get with pygtk related problems. That's also true for wxPython on the related mail lists: http://www.wxpython.org/maillist.php Regards, Dietmar -- http://mail.python.org/mailman/listinfo/python-list
Re: JTAG/Debugging
Dietmar Schwertberger schrieb: pepe schrieb: is there any python package which potentially can support JTAG (BDM or others) debugging interface for embedded system development? Is there any other packages supporting debugging, monitoring, data logging, flash programming of embedded systems? Don't know about JTAG, but I've successfully used a TBDML interface from Python to control S12 microcontrollers via BDM. Basically, any BDM or JTAG interface should have a DLL as driver which you can import using ctypes. Sorry, hit the wrong button... Low level usage via ctypes looked like this: import ctypes tbdml = ctypes.windll.LoadLibrary("tbdml.dll") # connect tbdml.tbdml_init() # returns number of devices tbdml.tbdml_open(0) tbdml.tbdml_target_sync() # returns 0 on success # play with micro ports tbdml.tbdml_write_byte(0x0,2) # set port tbdml.tbdml_read_byte(0x0) # read back With a small wrapper around, usage looked like this: import TBDML t = TBDML.TBDML(device_no=0);t.target_sync();t.target_reset(0) t[0x00] = 2 print t[0x00] If that's what you need, contact me. Regards, Dietmar -- http://mail.python.org/mailman/listinfo/python-list
Re: JTAG/Debugging
pepe schrieb: is there any python package which potentially can support JTAG (BDM or others) debugging interface for embedded system development? Is there any other packages supporting debugging, monitoring, data logging, flash programming of embedded systems? Don't know about JTAG, but I've successfully used a TBDML interface from Python to control S12 microcontrollers via BDM. Basically, any BDM or JTAG interface should have a DLL as driver which you can import using ctypes. -- http://mail.python.org/mailman/listinfo/python-list
Re: Choosing GUI Module for Python
sturlamolden schrieb: On 14 Nov, 15:35, Dietmar Schwertberger wrote: self.m_toolBar1 = self.CreateToolBar( wx.TB_HORIZONTAL, wx.ID_ANY ) self.m_button1 = wx.Button( self.m_toolBar1, wx.ID_ANY, u"MyButton", wx.DefaultPosition, wx.DefaultSize, 0 ) m_toolBar1.AddControl( m_button1 ) I can confirm this. There seems to be a bug in the generation of Python code for wxToolBar. If anybody faces this problem before a new revision of wxFormBuilder will be available: an XML file need to be updated to correctly include self. The modification: wxformbuilder\output\plugins\common\xml\menutoolbar.pythoncode: self.#parent $name.AddControl( self.$name ) Regards, Dietmar -- http://mail.python.org/mailman/listinfo/python-list
Re: IDE for python
sturlamolden schrieb: On 15 Nov, 18:09, Peng Yu wrote: There had been some discussion on IDE. But I'm not sure what pros and cons of each choice. Current, I'm using vim and ctags. Could somebody give some advices on choosing the best IDE for me? There is a plug-in to develop (amd debug) Python using MS Visual Studio. It works with IronPython and CPython. There is the PyDev plug-in for Eclipse. There is Komodo from ActiveState. There is KDevelop in KDE4. Which is better? I don't know. My impression is that Python development does noe need an IDE like e.g. C++ development do. There is no build process, which takes the major advantage of the IDE away. I am fine with a editor like IDLE or Kate. For more than ten years I had the same opinion. I found that a very lightweight "IDE" like PythonWin is sufficient for me together with print statements and the built-in post-mortem debugger for debugging. But then, last year I had to find a tricky bug in my GUI code (wxPython) and thought that for this problem a debugger would be helpful. So I gave the Wing IDE with it's debugger a try and have been using it since then. Even though an IDE is not an absolute must, I found that my productivity increased a lot (25%?) and I would not want to miss: - code completion - powerful debugger (even if you only use the post-mortem debugger it will save you a lot of time compared to pdb.pm() as it takes only a mouse click to move to the exception point in the editor instead of looking at the line number and then find the same point in the editor...) - Mercurial integration - PyFlakes integration Regards, Dietmar -- http://mail.python.org/mailman/listinfo/python-list
Re: Choosing GUI Module for Python
sturlamolden schrieb: On 14 Nov, 19:02, Dietmar Schwertberger wrote: I tried 3.01.63. I can see in the Python window already that the code is not correct. 3.01.63 Did you remember to install the wxAdditions? No. I think that they should not be required (a minimal version seems to be included in wxFormBuilder) and I don't get any error message. Also using wxAdditions for wx Python doesn't seem to be straightforward. Could you send me an .fbp file demonstrating the error? Sent by email. Did you receive it? Regards, Dietmar -- http://mail.python.org/mailman/listinfo/python-list
Re: Choosing GUI Module for Python
sturlamolden schrieb: On 14 Nov, 15:35, Dietmar Schwertberger wrote: self.m_toolBar1 = self.CreateToolBar( wx.TB_HORIZONTAL, wx.ID_ANY ) self.m_button1 = wx.Button( self.m_toolBar1, wx.ID_ANY, u"MyButton", wx.DefaultPosition, wx.DefaultSize, 0 ) m_toolBar1.AddControl( m_button1 ) (i.e. "self." is missing) I had problem like that with the first beta, but not the one from August. Which one? There are two: 08/23/2009 Version 3.01.63 (Beta) 08/19/2009 Version 3.01.62 (Beta) I tried 3.01.63. I can see in the Python window already that the code is not correct. Regards, Dietmar -- http://mail.python.org/mailman/listinfo/python-list
Re: Choosing GUI Module for Python
sturlamolden schrieb: I personally feel the wxPython support in the 3.1 beta of wxFormBuilder makes the choise rather simple. It generates a Python file with classes for all WYSIWYG GUI forms/windows/dialogs. Then in our Python code, we just import and inherit the form, and implement the event handlers. It can't be done easier. GUI programming with Python is now comparable to programming with VB, Delphi or C#. I am using it for all my projects now. It just feels right. Yes, wxFormBuilder looks very promising. But I don't think that 3.1 in it's current state it can be recommended for general use already. I just tried the latest version (from August) and it does not even generate correct Python code: self.m_toolBar1 = self.CreateToolBar( wx.TB_HORIZONTAL, wx.ID_ANY ) self.m_button1 = wx.Button( self.m_toolBar1, wx.ID_ANY, u"MyButton", wx.DefaultPosition, wx.DefaultSize, 0 ) m_toolBar1.AddControl( m_button1 ) (i.e. "self." is missing) Regards, Dietmar -- http://mail.python.org/mailman/listinfo/python-list
Re: Get the hard disk hardware serial number
MRAB schrieb: Jorge wrote: I need to know how to get the hardware serial number of a hard disk in python. For Windows, see http://www.daniweb.com/forums/thread187326.html This recipe uses the function GetVolumeInformation(), which does not return the hardware serial number. From the microsoft documentation: This function returns the volume serial number that the operating system assigns when a hard disk is formatted. To programmatically obtain the hard disk's serial number that the manufacturer assigns, use the Windows Management Instrumentation (WMI) Win32_PhysicalMedia property SerialNumber. The WMI method is e.g. described here: http://www.velocityreviews.com/forums/t359670-wmi-help.html import wmi c = wmi.WMI() for pm in c.Win32_PhysicalMedia(): print pm.Tag, pm.SerialNumber or to retrieve the serial number for the installation drive: serial = c.Win32_PhysicalMedia(["SerialNumber"], Tag=r"\\.\PHYSICALDRIVE0")[0].SerialNumber.strip() Regards, Dietmar -- http://mail.python.org/mailman/listinfo/python-list
Re: install pyPgSQL on Windows for python 2.5
someone wrote: Hi, does anyone know how to install pyPgSQL on Windows? There is no package for Python 2.5 on Homepage: I've installed newest Visual C++ Studio 2008 from Microsoft, but still no luck Hello Pet, you need Visual Studio 2003 to compile extensions for Python 2.5 If you want, I can send you a binary. Regards, Dietmar -- http://mail.python.org/mailman/listinfo/python-list
RE: what python technology for my app?
In article <[EMAIL PROTECTED]>, Robert Rawlins - Think Blue mailto:[EMAIL PROTECTED]> wrote: > Haha, no Troll, just a shameless plug for my life's one true love ;-) Strange enough to live that love on the wrong newsgroup... Until now all indications are: Troll Anyway, given the original poster's description I would be /very/ surprised that CF would be the right answer. On the other hand, you're writing that CF would deliver all kinds of PDFs, statistical charts etc. As I'm working on similar applications, I would be very interested to hear about how to approach such requirements in any language/environment. Please outline a solution to e.g.: - 1000 data files / lots - per data file / lot: - some meta information like: date/time, equipment, temperature, ... - 5000 data sets / parts for each data set / part: - 5 meta data entries / flags (16 bit int each) - 1000 data entries each (floating point value + 16 bits of flags) Example query/report requirement: - select 800 of the data files acc. to the meta information (e.g. date/time range) - select all data sets within the 800 files where the meta data matches some bit masks - calculate statistical data like min/avg/median/max, percentiles etc. per data file for the selected data sets - create a time series plot of these statistical results Regards, Dietmar -- http://mail.python.org/mailman/listinfo/python-list
Re: Length of read in in python-gpib
In article <[EMAIL PROTECTED]>, Madhusudan Singh mailto:[EMAIL PROTECTED]> wrote: > python-gpib provides Gpib.py (see end of post) for Linux. > > I am trying to use the method called read. I usually use it without > arguments (the default length being 512). However, I am trying to read in a > string with some 16,000 comma separated floating point numbers. I've never used python-gpib, but I'm using National Instrument GPIB cards with a wrapper that loads the driver DLL using ctypes. Usually for such long data you have to perform multiple read operations and check the card/bus status whether the read operation is finished (Code "END" - "END or EOS detected"). So with the National Instrument drivers I'm checking whether ibsta is something like 0x2000, i.e. 1<<13. The following code is a snippet from my sources. Hope this helps. From your post I can see that python-gpib also provides an ibsta method. I'd expect that END is also 1<<13. Regards, Dietmar import ctypes gpib = ctypes.windll.LoadLibrary("gpib-32") # read buffer _bufsize = 1024 _buffer = ctypes.c_buffer(_bufsize) _readstatus = 0x2000 _errorstatus = 0x8000 def get_ibcntl(): return ctypes.c_int.in_dll(gpib, "user_ibcntl").value def ibrd(handle): ret = [] ibsta=0 global _buffer while not (ibsta & _readstatus): ibsta = gpib.ibrd(handle, _buffer, _bufsize) new = _buffer.raw[:get_ibcntl()] ret.append( new ) if ibsta & _errorstatus: _raise(GPIBIOError, "ibrd(handle=%d): Could not read data."%handle, ibsta ) ret = "".join(ret) if '\012' in ret: ret = ret[0:string.find(ret, '\012')] if '\015' in ret: ret = ret[0:string.find(ret, '\015')] return ret -- http://mail.python.org/mailman/listinfo/python-list
Re: help w/ simple GPIB prog.
In article <[EMAIL PROTECTED]>, whoopsi mailto:[EMAIL PROTECTED]> wrote: >I thought I would simply be able to open a port, and send SCPI > commands to configure and aquire values. But when I tried to run GPIB > .py files from gpib-device-0.0.4 I got an error: "symbol 'ibsta' not > found". Doing some searching I found that ibsta was refering to a > library for GPIB (I'm assuming some .dll from a driver) and wrapping > them???. But these instruments as far as I know don't need drivers. Sounds like it's missing the driver for the GPIB board. What kind of GPIB card is it? The driver should be available from the web site of the manufacturer. Regards, Dietmar -- http://mail.python.org/mailman/listinfo/python-list