frougon / pythondialog Goto Github PK
View Code? Open in Web Editor NEWPython wrapper for the Unix "dialog" utility
License: GNU Lesser General Public License v2.1
Python wrapper for the Unix "dialog" utility
License: GNU Lesser General Public License v2.1
Hello!
Amazing python project. Please tell me, is it possible to customize the interface inside python or do we always need to edit the ~/.dialogrc
file?
Thanks in advance
Hello!
I am wondering if it is possible to have two widgets at the same time, one msgbox to display text and alter in realtime and a dialog text input under. Does the library support this? With the examples, running one widget after the other I'm not sure how to approach this.
Thanks
Hi,
I was playing with your code, and was wanting to offer some additional examples:
#! /usr/bin/env python3 import locale from dialog import Dialog
''' This is almost always a good thing to do at the beginning of your programs. '''
locale.setlocale(locale.LC_ALL, '')
''' You may want to use 'autowidgetsize=True' here (requires pythondialog >= 3.1) '''
d = Dialog(dialog="dialog")
''' Dialog.set_background_title() requires pythondialog 2.13 or later '''
d.set_background_title("YES/NO Help sample")
''' In pythondialog 3.x, you can compare the return code to d.OK, Dialog.OK or
"ok" (same object). In pythondialog 2.x, you have to use d.DIALOG_OK, which
is deprecated since version 3.0.0.'''
user_selection = d.yesno("Hi, this is a yes/no dialog box. You can use this to ask
questions that have an answer of either yes or no.
BTW, do you notice that long lines will be automatically
wrapped around so that they can fit in the box? You can
also control line breaking explicitly by inserting
'backslash n' at any place you like, but in this case,
auto wrap around will be disabled and you will have to
control line breaking yourself.", title="YES/NO BOX",width=0,height=0,help_button=True)
if user_selection == d.OK:
d.msgbox("You chose yes")
elif user_selection == d.CANCEL:
d.msgbox("You chose no")
elif user_selection == d.HELP:
d.msgbox("You pressed help")
elif user_selection == d.ESC:
d.msgbox("You pressed ESC")
else:
d.msgbox("WHAT DID YOU DO?!?!")
Hello,
I use pythondialog, thank's for your job :)
I try to color text in dialog, but is not work correctly in Python3
In old version (python2), it's worked nice, but in python3, it's almost work.
When i used this : "\Z5mytext\Zn", text is colored, but \ character apears in text.
Can you help me with this ?
Regards,
Currently, pythondialog is only available as a tar.gz archive on PyPI. The problem with this is that it requires the end user to have the setuptools package installed.
Providing a wheel file would solve this.
All that would need to be done is replace
from distutils.core import setup
in setup.py
with
from setuptools import setup
And then package it with python setup.py bdist_wheel
Hello,
When Dialog is created with autowidgetsize=True
, the textbox widget does not size correctly if file contains Tab characters.
It is probably a dialog backend upstream issue (using 1.3-20160209 here), because passing "--textbox filename 0 0" gives this same result.
I worked around this behavior by computing dimensions using maxsize()
so that window covers whole terminal regardless, but it's not an ideal situation.
Using extended ASCII chars like โ are counted with a larger width as displayed in the terminal. Meaning, the dialog window extends itself more than needed. Width can't be set to a lower setting, as it will throw a DialogError
and the note Can't make sub-window at (42,9), size (1,194)
This picture can only be obtained through setting width=0
:
Here is the original ASCII art, for testing of course ๐ .
xx______________________________________________________________xx
xx______________________________________________________________xx
xx________________________________________โโโโโโโโโโโโ__________xx
xx______________________________________โโ////////////โโ________xx
xx___________________________________ โโ////////////////โโ______xx
xx_________________________________ โโ//// __ ////// __ //โโ____xx
xx_________________________________ โโ////__โโ//////โโ__//โโ____xx
xx__________________________________โโ////__โโ//////โโ__//โโ____xx
xx__________________________________โโ//////////โโ////////โโ____xx
xx__________________________________โโ////โโโโ//////โโโโ//โโ____xx
xx________________________________โโ////โโ//////โโ//////โโ______xx
xx______________________โโโโโโโโโโ////////โโโโ//////โโโโ________xx
xx____________________โโ//////โโ////////โโ//////////โโ__โโ______xx
xx__________________โโ////////////////////////////////โโ________xx
xx________________โโ//////////////////////////////////โโ________xx
xx____โโโโโโโโ__โโ//////////////////////////////////โโ__________xx
xx__โโ////////โโโโ////////////////โโ////////////////โโโโโโ______xx
xxโโ////โโ////////////////////////โโ//////////โโ//โโ//////โโโโ__xx
xx__โโโโ//////////โโ////////////โโ//////////โโ//โโ//////โโ////โโxx
xxโโ////////////โโโโโโ////////โโโโโโ////////โโโโ__โโโโ////////โโxx
xx__โโโโโโโโโโโโ______โโโโโโโโโโ//////////โโ__________โโโโโโโโ__xx
xx______________________________โโโโโโโโโโ______________________xx
xx______________________________________________________________xx
xx______________________________________________________________xx
(It also suffice to just use a long enough line with extended ASCII symbols of course ๐)
EDIT: I figured out how to circumvent this: Setting tab_len=1
for this window allows setting the size, but also forces one to set it manually for this window.
from dialog import Dialog
d = Dialog()
d.msgbox("a\nb")
d.msgbox("c\\nd")
print("a\nb")
print("c\\nd")
Both msgbox
es show two lines.
The print
shows something different.
Is this on purpose?
Debian, python3-dialog 3.5.1, Python 3.7.3, dialog 1.3-20190211-1
I am currently using python3-dialog 3.4.0-1 (with Ubuntu 18.04). None of the password dialogs show the '*' characters when I enter the password but the dialog do record the password input.
Many thanks
Joe
The documentation has a wrong assignment for attributes in elements description
it says:
0 := hidden
1 := read only
but should be:
0 := text
1 := hidden
2 := read only
Hi, thanks for your lib.
I don't find any doc about testing. Is that possible? If yes, what is the best practice?
Thank you !
Here is the class I would like to test for giving you an idea if it can help.
Trying to create a msgbox with color as d.msgbox("\Z1test\Zn regular",color=True) renders the string text in red with the text regular in the usual black color. However, the \ characters preceeding both the Zs remain in the text. So the above text gets rendered as \ test \ regular
with the colors correct.
pythondialog = 3.5.3
dialog = Version: 1.3-20171209
I'd like to have the menuconfig-like interface in a pure python utility. It seems that the urwid library has some half-baked dialog.py in its examples - I wonder if this could be baked in into the lib so that no external exe would need to be called if urwid exists;
or, pythondialog speaks of "dialog-like" backends; are you aware of any that would be pure python or at least installable on Linux / Mac with pip?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.