#user-interfaces
1 messages · Page 87 of 1
or use Mad_lbl = Label(root, text='Mad').grid(row=0, column=0)
its better
not that
okay
soo... was it helpful?
umm sorry but not really what i was looking for
oh okay, thx ig
i want to know where i should put it not how i should put it
its ur choice...
i cant decide
but then the other corners look empty
maybe, u can fill the cornors with stats ( of the App / Software )
is it a AI application?
yes
oh
ai assistant to be exact
save some space for the AI ig
cool
In MainModule when using add, the classes are not being called and when you do call them they should probably be passed in a parent window. For example General should probably be General(self). The ttk.Frame's need changing to except the parent and pass it to super.
class MainModule(ttk.Notebook):
def __init__(self):
super().__init__()
self.add(General,text="General")
self.add(SCF,text="SCF")
self.add(Optimization,text="Optimization")
self.add(Thermochemistry,text="Termochemistry")
Edit: self.notebook = main_module.MainModule() MainModule also does not have a parent set
As stated above your __init__'s need to take in a parent and that parent need passing to super
example
class General(ttk.Frame):
def __init__(self, parent):
super().__init__(parent)
like here self.runtype_label = ttk.Label(self,text="Runtype:") there is a Label, self is it parent
yep I said that back there too 😉
I heard the docs for GTK on Python suck, is that true?
Do you mean like what is shown here https://stackoverflow.com/questions/24644339/python-tkinter-resize-widgets-evenly-in-a-window
The link says
Give all rows and columns the same non-zero weight.
has anyone here worked with figma?
what package can i use for ui
Okayy
the only user interface library I use is msvcrt (MicroSoft Visual C RunTime), and I use two methods from it, getch and kbhit
XD
any libraries that have some good looking UI styles
ty 🙂
Looking for help with PyQt5. I need to update an svg image in realtime by changing colors of some of its elements, but I can't find any examples. Can someone give me a hint?
Apparently I could read the initial XML, store it somewhere, then change and rerender it, but I wasn't able to figure out how exactly
I think I found the solution
https://stackoverflow.com/questions/52837657/how-to-show-svg-image-in-pyqt5-from-string-xml-stream
how do i make an if statement over a button click in tkinter
like print "hi" when i click a button named CLICK ME!
Button(root, text="abc", command= your_function)
Make sure that u dont put () after ur function in above statement
Does anyone know how to find out the x coordinates of the center to place buttons there
i have my geometry of the application set to "400x450", but place(x = 200, y = 225) doesnt placce the button in the center
Is there a way to use a python dataclass (python 3.8) with tkinter to share data across different classes?
I was thinking I could create a dataclass and inherit that class in my different views to get the data. But that seems to be a horrible way to do it.. since it's not working.
Honestly I'm still grappling with how to best design this app in the first place. Trying to avoid dropping global vars everywhere and was hoping I could just create a couple different dataclasses to inherit from.
https://github.com/MikeCase/mkvhost
Is the repository with the code I'm currently working with. In the GUI directory I have main_screen.py and containers/main_screen_containers.py which are my classes with the different Frames for my main screen.
My dataclass is currently in containers/main_screen_containers.py called ScreenData.
Maybe I'm just using dataclasses entirely wrong but thought I'd drop a question and see if anyone could point me in the right direction.
Try putting attribute , anchor=CENTER
how does it work
what's the best way on structuring A basic Python application using tkinter
does anyone know how i can make a label display a variable
label can display text as far as i know, if you want to display a variable, use a frame instead
ty mate will try
np
I think Mood: Happy is all I need a label for
Add a weather icon to the weather thing so I don't think it's the temperature of my machine
Possibly changing with the type of weather
i think i dont even need the date and time there tho
@digital rose Please don't try to ping @everyone or @here. Your message has been removed. If you believe this was a mistake, please let staff know!
I need to generate a4 size paper having 16 somekind of lines of info well formatted.. which will be having values from db..
I don't have any idea how can I do it
Sorry if it's wrong channel
Is there a way to get a callback whenever something is edited on a lable with editable interaction?
label = qtw.QLabel(parent)
label.setText(process.title)
label.setTextInteractionFlags(qtg.Qt.TextEditorInteraction)```
two ideas come to my mind:
-
to use HTML/CSS for formatting. It certainly supports making stuff for printer.
So probably you could automate it being autoprinted into pdf format, which is basically a4 size paper. -
finding library that allows generating pdf/word/rtf or any other a4 related documents from code, and doing it straight from it.
second option could be tricky in available style formatting
while first option is certainly rich in all kind of formatting and often a lot of people know how to format in HTML/CSS, but learning curve can be tricker to people aren't familiar with it
Why does DearPyGui fail when ever i put add_text in my loop function
Does anyone know how to download pyside2-rcc it didn't come with my installation?
Could you provide example code? And why not post on the Dear PyGui Discord?
I should say just make riungh ui and work on backend properly then making the ui beautiful
how to change color of horizontal line in pyqt (not background color, just color of the line)
how would I get the string of what is in an input text dpg.add_input_text(label="Text Input 1", tag="string_value"), how would i know what has been typed in?
is there a gentle , beginners tutorial on QT
i appreciate the guidance
simple examples are best
C:\Users\minua\Downloads>ui.py
Traceback (most recent call last):
File "C:\Users\minua\Downloads\ui.py", line 192, in <module>
import imgs_rc
ModuleNotFoundError: No module named 'imgs_rc'```
Why does it not work?
when qt designer generates this code
what other python interface libraries also have something like qt designer?
cause it places it from the top left corner, so the top left corner would start at x = 200 and y = 225
Need help with tkinter. I've put up my query in the help mango channel
If someone can take a look
if i wanna make my own tui library, any reference that could be useful if i want to get started?
how to turn on/off tkinter checkbutton with toggle key?
can uyou help my
@slow hedge
@glacial star
@lofty rain
@deft knoll
@stray jackal
@wheat harness
@cunning quest Please don't ping people for help. Ask your question, and someone will help if they can.
I’m guess there is a away but i can’t find out, in pyqt5 is there a way “refresh” the window if a button is added?
I want to build a desktop app that reacts to speech recognition and renders stuff according to what is said. What modules can I use to create a pretty GUI?
The only one I messed with a little was Qt qml which was interesting because I could use my web experience.
any suggestions on how i can make this better?
hire a designer
I'm using Tkinter and when i click the button after entering text in malice_input, i see no results displayed in bob_input. Help!
malice_input = tk.Text(root)
ft = tkFont.Font(family='Times', size=12)
malice_input["font"] = ft
malice_input["fg"] = "#333333"
malice_input.place(x=310, y=290, width=198, height=111)
# bob_input declaration is same as malice_input
def malice_send_bob():
bob_input.insert(tk.END, malice_input.get("1.0", 'end-1c'))
malice_send_bob = tk.Button(root)
malice_send_bob["bg"] = "#efefef"
ft = tkFont.Font(family='Times', size=12)
malice_send_bob["font"] = ft
malice_send_bob["fg"] = "#000000"
malice_send_bob["justify"] = "center"
malice_send_bob["text"] = "SEND TO BOB"
malice_send_bob["command"] = malice_send_bob
malice_send_bob.place(x=440, y=420, width=130, height=25)
nvm... i got it. damn i thought def name can be the same as variable name :((((( silly me
I’m guess there is a away but i can’t find out, in pyqt5 is there a way “refresh” the window if a button is added?
you guys know the on and off value thing for checkboxes in tkinter right? so is there a similar thing for buttons as well?
hello guys , using tkinter to create a management system for keeping records and viewing , but came across an issue when creating a frame for the button sector, for some the attribute been declared and used but the first frame is not been detected in the second frame, pls I need help
Hey @late wolf!
Uh-oh! It looks like your message got zapped by our spam filter. We currently don't allow .txt attachments, so here are some tips to help you travel safely:
• If you attempted to send a message longer than 2000 characters, try shortening your message to fit within the character limit or use a pasting service (see below)
• If you tried to show someone your code, you can use codeblocks
(run !code-blocks in #bot-commands for more information) or use a pasting service like:
!code-blocks
Here's how to format Python code on Discord:
```py
print('Hello world!')
```
These are backticks, not quotes. Check this out if you can't find the backtick key.
this is the code above
Hi, what is the most reliable and best compiler ?? (pythong to executable . . . like cx-freeze) I use cx-freeze but am not happy with it
modern ones . . .
is there a way pyqt5 to refressh the page if you add a new element like a button?
This is the code I have so far
def showButton(self):
self.hey = QtWidgets.QPushButton(self.tab1)
self.hey.setObjectName(f"hey")
self.hey.setGeometry(QtCore.QRect(20, 100, 208, 21))
self.hey.setText(f"Hey")
That is the code that I have so far, and yes it is connected to this
self.OpenFile.clicked.connect(self.showButton)
Thats line for what it to do when its clicked
Nuitka
anyone here familiar with psaw and pushshift for reddit api
Is there when a button is pressed we use the after method and then delete a label that uses the place method?
Does anyone know an elegant solution for hiding the typing cursor in a QLineEdit (PyQt5)?
I'm trying to make a "wordle" clone as practice
maybe LineEdit isn't the best solution for the character boxes?
Is it editable directly by the user?
Yes
My current idea is to set them all to read-only mode, and use a custom key event for filling in the text
but that seems excessive
but then again, that's pyqt for ya
Could just use a label that gets set on a key event with mouse focus then
or whenever you need it to accept input
Yeah I guess at that point it doesn't even need to be a LineEdit
guys, i have a small doubt:
how can we make it so that on clicking a button once, a frame is opened, and on clicking it again, the frame is destroyed?
def settings():
setbar=Frame(app, height=650, width=250, bg="light grey")
setbar.place(x=0, y=25)
settingsbutton=Button(app, text="⚙️", command=settings)
settingsbutton.place(x=0, y=0)
this is all i could do till now...
and this is in tkinter, btw
tkinter?
hey people,
small question,
so i have a software / app and there is a Child Window and a Parent window
while a new Child window is being opened the Parent window hides by using this code ```python
def hide_main_window():
root.withdraw() # Hides the Parent / Main window
question() # opens child windows
now when the `Child` window closes ( the user presses the `X` button and closes the window ) the `Parent` Window ( which was previously `Hidden` ) should My Shown again?? ( instead of running in the Background / Tray )???
pls help
btw i use Tkinter
nvm
pls if anyone knows?
:incoming_envelope: :ok_hand: applied mute to @wary grotto until <t:1641910429:f> (9 minutes and 59 seconds) (reason: mentions rule: sent 6 mentions in 10s).
self.widget = QLineEdit()
self.widget.setAutoFillBackground(True)
self.widget.palette = self.palette()
self.widget.palette.setColor(QPalette.Window, QColor('lime'))
self.widget.palette.setColor(QPalette.Highlight, QColor('lime'))
self.widget.setPalette(self.widget.palette)```
self here is an instance of a subclass of a QMainWindow object. From what I nerstand, `QPalette.Window` defines the general bg color . However, when the program is run , the background isnt green? It's jsut the usual white?
Code I included is kept short (because I felt the rest of the program wasnt relevant; wanted to keep the message succinct)
You guys have any list of fonts?
What would be the best way to implement text input in curses? I'm aiming for a scrollable single line text input, similar to vim's command entry area?
I think you'll also need to construct a new palette and then give it to the widget instead of trying to change the widget's palette directly; it'll properly inherit for the unset colors
So if Base controls bg color what does Pallete.Window control?
I went thru the docs and form what little I understood, they had stated Pallete.Window is like a bg color?
Window is the window's background, Base is for some other backgrounds
Used mostly as the background color for text entry widgets, but can also be used for other painting - such as the background of combobox drop down lists and toolbar handles. It is usually white or another light color.
so you want a bit of a contrast between window and base to show that it's interactable
So why doesnt changing the window color do anything in my case? Is it because text entry widget bg color is controlled by Base?
Yes
if it had some space that wasn't used to enter things then that'd use the window color
in your case the window color should control what you see around the widget, if you set the palette on an object that'd change it
So in this case that object would be my MainWindow obj right?
Yeah, or the app directly
Thank you! This is handy!
So if I wanted to make a theme for the widgets in my app WITHOUT using style sheets, I have to edit the pallete for each and every object I plan to include?
Also if you dont mind me asking how did you draw those gray lines that border the yellow window on the bottom right?
Well they use the same color roles, you just need to set appropriate colors for all of them
Yes , so I have to do this for each and every widget? For fonts, If I set some font at the applicaiton level , all the child widgets automatically get the app's font. Is there a similar way to do that for colors/pallete?
The frame around the text edit or the lines that separate the widget text?
You can set the palette on the app and every widget will use it, or I think setting the palette on a widget will make all its children inherit it but I'm not completely sure there
these lines
I see
you can see that I do app.set_palette under the linked code
Thats just widgets inside a QToolBox
The colors roles are from QPalette.Light and QPalette.Mid
yes I caught that
wai so those grey lines are part of a widget?
or are they widgets themselebs
Also what exactly is a color role? Is it an alternative term for an enum?
Those lines are separating a TextWidget, TextEdit and Text Browser
They come from placing the items in a QToolBox.
These are the color roles of a QPalette
I see. Is there anyway to customaize the shape of those lines?>
You choose the colors to set on a colorRole, its how you would use a palette.
I'm almost 100% sure you can but, I'm not sure how to do it.
I don't think I've ever used a QToolBox before
but what is a color role exactly? I know what they do and what they are
are they like some attribute?
or one of those enum things?
I am not a very good programmer and this is my first time using tkinter. I need to create a booking system and i need to let people create an account and login through tkinter using databases. Is there any videos where they do this? I can do it to a read/write file. Thanks.
I'm not what you're asking then. They are an enum though.
I see
The color talk reminded me of an issue I've been trying to solve a couple days back but didn't reach any solution for.
I have a widget that blends text into the background on both of its ends through a gradient, but I don't know how to use proper blending on the transparent parts instead of blending it into a solid color, as the text has to be painted first using the widget's painter. Painting using an image or a QGraphicsOpacityEffect achieve the intended effect, but completely mess up how the text looks.
A partial solution would be some way to figure out the color of the background behind the widget, but would still not be ideal if the background is not uniform
In its current form where I use the window color it mostly works, but is out of place if placed on widgets that don't use a palette color directly
I have an idea
not sure if its any good
perhaps you overlay a plane that is transparent in the center but slighty opaque at the edges OVER the text?
keep the plane/image color same as the bg
Well that's mostly what I'm doing now with a gradient that goes from the window color to transparency and is overlaid over the text, but not all widgets will use the window background color, or it may be placed over something that's not uniform (e.g. some other widget with a gradient)
and so far everything I've looked at that would fix this, would require using something that messes up with how the text is drawn
I have a terribly hacky way
jhow about hacking the text rendering s code such that you get to change the color of the text rendered per character?
Characetrs at the edges get a transparent color, stuff in the middle get opaque colors
but yes like you mentioned, its super hacky
hmmm
I do have another idea
How about using something like PIL to take bitmap images of letters, color them into the colors you want on the fly and stick them one by one as images in ur widget?
although the performance implications for that...
Well the characters could be prerendered I guess, but that would still not use the native text rendered that the user is used to and is used everywhere else in the app
windows has to expose something for it that I probably could use to draw into an image but I'm really not going to dive into that
ye I believe that would be the only way to eke out fonts the users use
wait ummm
how about this
have the text the users type be rendered onto an image with a transparent bg. Multiply that image with a gradient and paste that back in as an image?
I think PIL let you type text onto images?
although idk if you can choose any fonts you want]
The font is not really the issue, but using the proper subpixel rendering method that the user chose when configuring their ClearType
Using normal b/w antialiasing makes the text appear less sharp, and even if PIL has direct tools for it, I'd need to hook into the win api to figure out the settings
and well any rotation would completely mess that its looks when not using the native font engine
Do you have a stylesheet on the widget to override the palette or something?
No, some just don't use a color directly but a darker/lighter variant from one of the colors that are set
then if I place my widget over that, it'll blend into the window color which is different
I don't know if this is the right channel to ask this question but as a former heavy Excel user learning python with the primary goal of pandas expertise, has anyone played around with Mito?
Heard it from talkpython.fm it looked pretty awesome
Its cool, it is a great learning tool for newbies like me but no regression analysis function
I asked about it on their discord
but I suppose pandas doesnt have an "in package" regression tool, that could be the reason, but numpy and scipy does
even simple linear
I heard about it today on "talk python to me"
I was talking about Pandas when I said : "but I suppose pandas doesnt have an "in package" regression tool, "
This probably doesnt belong in this channel but its the only channel I can think with this question:
How do I access a GUI in a system that doesn't support GUIs? For example if I am SSHing into an ubuntu server that has a fresh nodejs server running with nothing installed, but I would normally be able to just type in localhost:3000 into a browser
Yeah that's the same channel as talkpython.fm 🙂
😛 apparently I suscribed to the same podcast twice
Wonder why they are shown as 2 seperate casts
Talk Python has ways to access 'no-add' version called pro-edition. This is provided as a private rss-feeds to only who have purchased everything bundle from the training site in talk python. Maybe Michael, the host of the podcast, have done sth that could make duplicate instances of the feeds
ahhhh. gotcha. I am using podcast addict and that might not show everything the same as itunes or w/w
w/e*
if you are in windows, then Putty program allows to connect via ssh
while in settings turning on port forwarding feature in Connection -> SSH -> Tunnelling?, that will transfer server requested things at certain ports to your localhost, when SSH connection is established.
It is possible to install putty at linux too.
Btw, it is possible to access even VSCode gui at the server, VSCode allows ssh remote connections
Also! Trying to get JupyterLab Desktop working (same ep)
I gave up on that idea. It simply does not work. Well it kinda works well if you have a server & web setup, but not in desktop GUI frameworks. One time TKinter asked me for GTK when I was ssh-developing from Windows to Raspbian. During my search I found out that there is a way to transfer to a client side framework but I dared not to try it
Im a newb and cant seem to get it working
I’m confused, this only helps me connect to the instance when I’m already connected, but doesn’t let me open any GUI (say, localhost:3000) remotely. Am I missing something?
you are supposed to install Putty only at your client, not at server
and from Putty to make ssh connection with tunnelling turned on
Hmm I see
How would seeing localhost work through putty? Normally I’d open a web browser and type in localhost
But wouldn’t I have to type in the SSH’d instance’s IP? Wouldn’t the instance need to be able to serve from non local host?
U can make port forwarding
you write at which localhost:PORT you wish to access the thing through the server, which would connect to DOMAIN:PORT at your behalf, when you access your localhost:PORT
Ahh.. this is totally unknown waters, so I appreciate your patience with me. I’ll give this a try
Obviously when you establish connection to your server, you need to point its domain or ip, and port for ssh
basically only those two tabs are required
Session and Tunnels
So port forwarding here allows me to basically tell putty “ localhost at this port maps to my client’s address here”
localhost of the client at this port maps to my server target's address here, in order to use server as a proxy for the client
(you could be pointing not just internal, but external ip addresses too, so u could connect to google on behalf of the server as example)
but you are basically needing to point localhost, to connect to server localhost on his behalf
localhost:YOUR_PORT => localhost:SERVER_PORT
Sweet! Thanks so much, I’ll give it a try. I didn’t think it would be this easy; a quick google talked about reverse proxies and stuff
u a welcome.
just a tip, for debugging purposes you can always verify that your server has the thing running where you wish with curl installed to linux server
if it shows something in the console not of the connection refused type , then your thing is working at the server
I mention it because sometimes additional troubles can be in the way, it helps to verify things in addition.
obviously port forwarding is working, only while SSH connection is established / putty is opened 😉 Once you close it, forwarding is canceled.
Turns out I got way ahead of myself, I don't know how to install jenkins from docker yet so I can't test the above yet, oops.
Forgive my ignorance. In this screen I put source port as 8089 (I'm sure it can be anything that's not used right?)
And I put destination as <IP-of-host>:8080 (trying to access jenkins auth page from client)
My question is, shouldn't I be entering through localhost:8089 to access localhost:8080 of the host then? Since the mapping says L8089 => <IP-of-host>:8080?
sure, anything that is not used.
except that you can possibly be having a bit harder time for ports in a 0-2999 range perhaps? Not sure for sure.
at least linux is not allowing binding to ports 80/443 unless root
Returns a refused connection, and I presume that is because my client doesn't have anything listening on that port
But putty is connected and the above settings applied
hey anyone I have a question:
which one looks better?
- The one with the rainbow is the old one
- The other is a mock-up made in qt-designer
This is for the CMPDL project: https://github.com/Advik-B/CMPDL
In pyqt5 how do you get a item from a tree with a double click?
I like the new one
the one with out the rainbow
ok thx for the feedback 🙃
how did u get the rainbow
If it's a QTreeWidget there's a itemDoubleClicked signal, otherwise hook into the mouseDoubleClick event and get the appropriate item from event's coords
sharex
Hey @topaz depot!
It looks like you tried to attach file type(s) that we do not allow (.sxie). We currently allow the following file types: .gif, .jpg, .jpeg, .mov, .mp4, .mpg, .png, .mp3, .wav, .ogg, .webm, .webp, .flac, .m4a, .csv, .json.
Feel free to ask in #community-meta if you think this is a mistake.
it is NOT an exe it is an sxie. a file image formater for sharex
How is that helpful
if you have sharex then download it and click on open with sharex
I don't have sharex. What is in that file
json data
if you want. just rename it to filename.json
and open it
does anyone know how to fix error ```_tkinter.TclError: invalid command name ".!treeview"
I'm new to python and I don't understand why I am getting this error. Why does my main window not recognize that it has the Qcombobox named vehicle dropdown?
Can any front end developer please quickly look at the UI of my website on both Mobile and Pc and give me some suggestions on how to improve the UI? Link: https://codewani.pythonanywhere.com/
#help-cookie pls
doesnt work
? what dosent work
Changing the format
I do not have sharex
why don't you share the file directly?
you cant
unless u have sharex
u can download it from microsoft store
Can you explain in words, how you made the rainbow?
I downloaded this file and double-click on it
it is from @oblique isle
he is my friend
so there is no code for it?
the file is in json format
so yea
that is the source code
Mmmmm
i dont understand, do you know what your telling? You showed a window but what you gave is just a rainbow picture, is this a GUI that can be coded?
no
that rainbow part is NOT the gui
then why is it in the screenshot of the GUI
it is extra effects because of sharex
I am really sorry. I got you confused thinking that it is a part of the GUI
No probs, I was just curious, looks fancy
if only i could manage that
yea its not easy
yea its just a nice border effect for your pictures
alr
Random question, in tkinter, can a place items on top of a grid overlapping? I am wanting to place some items in the corners of a screen and have a grid acting as a split bar graph behind it on the top row
How To Use eel package, it's used for building UIs with frontend technologies with HTML and CSS Except JS
Indirectly It's A Web Browser
That Runs HTML
I use PyCharm from the Snap Store and every damn update I've gotten for months seems to have made it worse and worse. Is it just me or is the software nearly unusable now? It doesnt parse the code properly and it takes forever to analyze changes as I make them.... usually requires a restart
what is the easiest way to display a whole pandas dataframe in tkinter?
If anyone keyword searches this and has slow code inspection, updating, analyzing in PyCharm: make sure you right click and exclude the project files you don't need to be inspecting from the project structure. I do my work in one file of a large directory and it turned out python was inspecting all the project files/sub-directories. It took forever for PyCharm to catch errors in my code (if it ever did!) and a very long time to update after each change I made. It was like I was writing in notepad for the past year.
hey how u move a button in tkinter? to left
button.pack(place=LEFT) ?
side=left?
hello, can I draw something on the screen with pyqt5? It will be manually like in paint.
i tried
window = tk.Tk()
tk.Label(text="Hello, world").pack
window.mainloop```
but it doesnt make any windows
how can i fix this problem
im big dumb
How do you make a pyqt application that has multiple pages?
@upper sluice
import tkinter as tk
window = tk.Tk()
label = tk.Label(text="Hello, world")
label.pack()
window.mainloop()
That should fix it
yea i saw that i forgor the ()
how can i get the value of a text field with kivymd?
i checked the docs but couldnt find anything
.text ?
rate
I'm trying to make a muilt page application in pyqt5 and this is the code that I have currently. MainWindow is the window I want to first show up. Then I want Screen to show up when pushbutton is clicked.
The code is below
https://paste.pythondiscord.com/zecejiloyi.rb
i forgot the command for tkinter that has i think message box in it or something like that? its a import command could i have some help
also for some reason when i do import tkinter* it comes up as syntax error which didnt happen at my school computers
how to run Tkinter code in visual studio code???
Vs code is a code editor
Write code in a file
Open terminal, run that file:python file.py
from tkinter import messagebox
To import everything from tkinter you need to write: py from tkinter import *
Is there anyone who is doing ui ux design or learning??
Um can someone that has worked with Tkinter DM me?
I need help and I tried posting in the help channels so many times but I got no response...
Python - GUI Programming (Tkinter), Python provides various options for developing graphical user interfaces (GUIs). Most important are listed below.
setBackground(self, Union[QBrush, QColor, Qt.GlobalColor, int, QGradient]): argument 1 has unexpected type 'QColor'
am i missing somethin or .......................
TypeError: setBackground(self, Union[QBrush, QColor, Qt.GlobalColor, int, QGradient]): argument 1 has unexpected type 'QBrush'
ummmmm
it literally says it expects Union[QBrush, QColor, Qt.GlobalColor, int, QGradient] but its not accepting themmmm
i wanna set background of QTableWidgetItem but it only worked with Qt.GlobalColor or by int (which idk how its calculated)
Hello, I want to draw a picture on the label with pyqt5, how do I do that?
I also want to use what I drew
use qpixmaps
scale it to the size of your label and use Qt.SmoothTransformation so that it looks nice when scaled
and then just label.setPixmap(pixmap)
how to draw with pen or brush
how to make a custom button widget in pyqt? (plz ping when reply)
what custom behaviour do you need from it?
Is there a way to change the column background color?
https://replit.com/@0xNoUser/PasswordManager
What do you think about it's UI?
how to make a custom button widget in pyqt tat changes color when clicked n hv a "clicked" signal?
it's nice and simple, but if you want good looks I would've used pyqt instead.
When I created that i neither knew tk nor qt i made that in few hrs as my high school project
But now I have started learning qt
that's nice, how far are you in qt now?
Hey! Any UI ux designer? Or who is learning it?
Would love to chat up.
Just have few doubt.
hey a small question
so i wanna make it so the resolution is what i have told it to be on a window it opens
whats the function again?
i forgot
Someone plz help
self.button.clicked.connect(lambda: self.button.setStyleSheet("background-color: rgb(100, 20, 30)"))
it doesn't have to be custom button to be able to do it
Is this Channel for ui/ ux design??
Or am I in wrong Channel?
Hey @pallid panther!
It looks like you tried to attach a Python file - please use a code-pasting service such as https://paste.pythondiscord.com
The name is user interfaces
which is UI
So
Cool! Can you recommend good resources which cover basis for a newbie ui/ux designer?
Are you wanting to design websites
Well I don't know rn cause I am just starting out but would love to go with website.
And for app??
UI UX designers design the application i don't think they write code
Ig they are the one who use figma xd sketch....
yea you can do those too for when you want to simulate a design
But you will prolly eventually have to code it
But that's not what a ui ux designer do 👀
That was what I was wondering.
I heard that they are not responsible for coding part .
Its optional and plus if they wanna upskill themselves they can do coding part also
Are you UI ux designer?
what framework did you use for that
No I'm not but in past i have done some UI designing using figma
Tkinter but you should learn pyqt or dearpygui
Three things that i struggle in UI are font family (CSS was my 2nd language 👀) , Color and whitespace... I think most newcomer find these 3 difficult
Oh!! Nice.
What course did you take at first to clear out your basic of ui ux?
i didnt took any course it was mostly some article from uxdesign.cc
my way of doing practice was simple try to replicate the designs from dribbble
Okay thx
Is there a way that the sizes of the buttons, labels etc. automatically change by the size of the window in tkinter
why is that
why not tkinter
Hi
I have a quick question
is kivy (the python module) still used for app development?
Thanks!
I'm trying to make a super simple GUI for a program i have, so far, it needs a button and float input (so super basic) but wish to expand upon it to add pictures or even better, transparent to overlay on another window. what lib would be best for me? I've been using some pyqt5 but it feels like it was lazy hacked together and doesn't feel pythonic with the limited time with it. I could just power my way through pyqt5 but i want to hear if there are better options for me.
use TKINTER
i hate kivy and pyqt5 cause no MAC M1 versionnn
???
Hey! Any UI ux designer here?
If yes,can you lay down what are basics one need to master for ui?
Not many basics, just be creative with your designs. There are some rules you should follow though. You can use Figma or Adobe XD to create some ideas for designs
Like typography , color fonts n all?
Do you know any specific video which can clear out the basics?
you just need one more after that
ah does anyone remember the qt class which asks input in a different small window
this one? https://doc.qt.io/qt-6/qinputdialog.html
yes thanks
HI, I'm using py QT Designer, is it possible that the tool box has all the tabs closed by default?
If u are using pack, simple set expansion to True, if u are using grid, add a minimum weight of 1 to all the widgets u want to expand with the window
Python glut libary is really use in production ?if yess please tell some name of company?
Im trying to build a math helper for a certain subject of mine here in college wherein I'll just put numbers for this equation and it gets solved. The functionalities are done. Only left is to put it in a UI.
Thinking of Kivy or PyQt but I have little idea about these two. Can anyone suggest which one to pick?
Kivy, it takes time to get used to kivy Lang but it feels much more refined UI building-wise
Kivy can be used on all platforms I believe and is fairly easy once you've installed the modules. Loads of tutorials on youtube!
I would recommend Qt, they have wonderful docs and classes for everything
im trying to learn pyqt and i wanna a add scrollarea but i can't add labels to it what should i do inorder to add a labels inside of scroll area ?
What are your requirements?
Dear PyGui might be a good fit as well.
personally I'd go kivy, but if completely new to gui libs, just choose one and you'll be fine
Hi guys, i made a small software whit gui to find some files in a directory.
Runnung the gui on windows it look very nice but running it on android look like this:
im using ttk as library
in windows rhe treeview is 50% the space avaiable
But on android it look like this
Specially vertical mode
And also all labels are super tight
What property sould i change to fix it?
hello community, anyone expert in wxpython? I need help with an issue.
Don't wait for an expert, just ask your question and if someone can help they will.
I made a tool using wxpython, consisting of registering people in a database (sqlite), so far, well, when I query the data, I get them in sqlite3, store the data in a variable and play the data in a wx.listctrl(). When I do this the first time, everything works fine, the second time onwards it's the problem, the new data is replaced by the old ones when I try to select one of them, as if the first data I consulted is not erased, overwriting the data of the next queries . how do i solve this?
Can you post the smallest possible sample code that shows the issue you are having, no sqlite3 code is necessary just hard code some data. so just a frame, panel with a listctrl, that initially inserts a few rows and then a button to change the data in the way that you are doing it in your main code.
So I have a small question I can't figure out. Basically I have a QStackedWidget in a window in PyQt and I want to have a few pages which is all fine up until the point I want to have each page for the stacked widget separate. I thought creating a new file in qt designer with the QWidget template would be enough but that is by default a form and cant be added to the stacked widget after the fact. What am I missing here, how would I separate the files in a good manner to use?
Basically I want to have each page of a QStackedWidget in separate files.
I never touched any GUI on Python before
Wich would be a good lib to start
I have some experience with PyQt and Id say its quite good for simple stuff especially with the qt designer it allows you to design apps in UI and not hardcode them from the getgo but I dunno about the other ones
def buscar(self,event):
self.dados_consulta_individual_states.clear()
self.Refresh()
print(self.dados_consulta_individual_states)
# create the list control
self.lc = wx.ListCtrl(self, wx.ID_ANY,
style=wx.LC_REPORT, pos=(120, 160), size=(400, 350))
self.lc.RefreshItems(0,1000)
connection = sqlite3.connect("membs.s3db")
cur = connection.cursor()
Onome = self.onome.GetValue()
#procurar pelo primeiro nome
sql="SELECT nome,situacao,cidade FROM membrosIgreja WHERE nome LIKE '" + Onome +"%' ORDER BY nome"
cur.execute (sql)
result = cur.fetchall()
cur.close()
connection.close()
#---------------------result-----------------
#states = list(result)
self.dados_consulta_individual_states = list(result)
#print self.states
print(self.dados_consulta_individual_states)
# select an item (left mouse click on it) and bind to a method
self.lc.Bind(wx.EVT_LIST_ITEM_SELECTED,self.onSelect)
# create and load the columns with header titles, set width
self.lc.InsertColumn(0,"Nome")
self.lc.SetColumnWidth(0, 140)
self.lc.InsertColumn(1,"Situação")
self.lc.SetColumnWidth(1, 120)
self.lc.InsertColumn(2,"Cidade")
self.lc.SetColumnWidth(2, 130)
# load the rest of the list with data
self.loadList()
self.lc.update()
I already tried to clear the variable that stores the data, I tried to clear the wxlistctrl and nothing came of it.
I've installed UniCurses in my venv and I'm getting this error when trying to initialise it (i.e. stdscr = unicurses.initscr()):
Expecting pdcurses at: C:\path\to\my\project\venv\Lib\site-packages\unicurses/64 bit binaries/pdcdllu/pdcurses.dll
The file it's referring to is there so I don't understand what's wrong.
is it a framework? it may be corrupt, this happens to me regarding kivy, reinstall the framework
It's a module providing Curses functionality on Windows. I'll try reinstalling but it's a fresh install so I don't think it's corrupted.
Yeah getting the same error
Has anyone of you have taken ui ux bootcamp? If yes,can you share your experience?
hoii does anyone know how to use the blessed library i need a little help
wide = int(term.width / 2 - 11)
high = int(term.height / 2 - 6)
with term.location(wide, high):
print(term.sienna + logo + term.normal)
it SHOULD appear in the middle of the terminal, but it isn't appearing in the middle of the terminal :|
hey uh i would like to get some help in pysimpleGUI
i wanna get a value out of a text input box and i cant do it
its meant to be number tho
idk what is the number one
wx.ListCtrl example
https://paste.pythondiscord.com/jerekozoxi.rb
Hi, can someone help me... I'm having trouble installing PySimpleGUI
any recommendation on laying out nice terminal interfaces? I want to display some json output in a nicer fashion in the terminal than what jq outputs
What’s the issue?
question about sizes when i program my first app. every doc and tutorial i can find shows me fixed sizes for width and heights for any widget. but with all the screen sizes today like hd, 4k , 8k, isnt it better not using fixed sizes?
Yes, usually you use relative positions, anchors etc.
but a good framework can take care of dpi awareness for you
does someone using kivy ? for the background_color it uses rgba.. atleast the docs says that. but it uses only numbers between 0.0 and 1.0 ... so im confused now
cant find the real codes
Hello, I'm trying to figure out patterns with pysimplegui and why my text object won't refresh. I'm on help-pancakes
I'm using pyqt5 to make some changes to an existing ui. I am using a Combo Box and I want to expose the index of the combo box to be used in the method of another class(different from the one where I am defining the features of the Combo Box. Is there any built in function besides currentIndex()[since it cannot be used outside the class] which can allow me to do so?
Can someone explain to me how exactly masking with QRegion() works in PyQT5?
class RoundedLineEdit(QLineEdit):
def paintEvent(self, event):
super().paintEvent(event)
roundCorner = QRegion(100,120,90,30).intersected(QRegion(120,140,100,50))
painter = QPainter(self)
painter.setClipRegion(roundCorner)
painter.begin(self)
painter.end()```
This is what I have on hand. Intention is to create a rounded rectangle and intersect that with whatever rectangle `lineEdit` draws on, so that I can draw `lineEdits` with rounded borders. I am not exactly sure how to get my own custom QPainter implementation working though
The rest of the handling of paintEvent should mimic that of `QLineEdit`, I just want the QRegion to be a rounded rectangle. How do I get it right?
Note: I know roundCorner isnt really a rounded rectangle, I just wanted to test out QRegion masking for the time being
For the time being, this error is spat out evertime : QPainter::begin: Painter already active
No idea why it occurs
is anyone familiar with tweepy and the extended_tweet field
hi guys
umm I was trying to install pyqt5-tools but it kept giving me this error
there's more to this its huge so i just sent some of it
the ending especiaaly
anyways the tutorial i was using was going over the drag and drop method as well what do yall use the drag and drop or just code it?
is qt-creator the same?
ok i somehow installed it
all thanx to this
why does pynput break pysimplegui
Any clue on how to make a better-looking progress bar using Tkinter.
something like this.
rather than
hello guys, I'm having problems installing packages in python, I always get an error, I can't install wxpython, kivy, kivymd and others, I've already tried to install from the terminal inside the python packages folder, through pycharm, and nothing worked, always gives error
With customtkinter you can create such a progress bar: https://github.com/TomSchimansky/CustomTkinter
Using ttk.Style()
I want to develop an interactive dashboard using bokeh and flask.
Here is what the interface would somewhat look like:
I wanted to do the following with this interface:
- I have received a data from the user, from the previous page. The data will be processed on server side based on an algorithm, and plots are going to be generated.
- I have that algorithm loop running on server side, and the plot corresponding to say iteration 1 is shown
first on this interface. The loop should pause and proceed for iteration 2 only when I click next. - Also, say I keep clicking next and I reach iteration 5, I now want to go back to iteration 3, I must be able to do so using the back button
shown above.
(Note: At each iteration, new plots will be shown based on calculation done on server side)
My question is how do I go about developing this sort of an interactive interface?.
I am a beginner in flask/bokeh. On top of it I have no knowledge of web technologies like JS, AJAX etc.
Are there some good learning resources like courses/books so that I learn about how to construct these
kind of interactive interfaces? Coz I am unable to find a solution for this currently.
does anyone know how to bind the scroll wheel to scroll up or down on the scroll bar in tkinter?
The mouse wheel?
mhm
?
the mouse wheel, yes
either way you can use something like widget_name.bind_all(“<MouseWheel>”, function)
i tried that and it just says "expected integer but got "1.0"
and when i make it an integer it does nothing
There’s a good example on here https://stackoverflow.com/questions/17355902/tkinter-binding-mousewheel-to-scrollbar
thats the example i followed, and for some reason it doesn't work
I might need to see your code
def __init__(self, FRAME):
super().__init__(FRAME)
CANVAS = tk.Canvas(self, width=1550, height=600)
self.children["!canvas"].bind_all("<MouseWheel>", self.scroll)
SCROLL_BAR = tk.Scrollbar(self, command=CANVAS.yview)
self.SCROLLINGFRAME = ttk.Frame(CANVAS)
self.SCROLLINGFRAME.bind("<Configure>", lambda x: CANVAS.configure(scrollregion=CANVAS.bbox("all")))
CANVAS.create_window((0, 0), window=self.SCROLLINGFRAME, anchor="nw")
CANVAS.configure(yscrollcommand=SCROLL_BAR.set)
CANVAS.grid(row=0, column=0)
SCROLL_BAR.grid(row=0, column=15, rowspan=15, sticky="ns")
def scroll(self, event):
self.children["!canvas"].yview_scroll(-1*(event.delta/120), "units")
i do self.children["!canvas"] because self.CANVAS didn't work
can someone please help ? https://stackoverflow.com/questions/70824713/increasing-tkinter-clarity-on-linux-osx
I have the same question, what do you mean by clarity?
the tkinter window resolution?
so i have 3 table widgets and i want to change the color of them once they lose focus, like when you click on one other two will change color of the selected row to indicate that they aren't focused rn, also if you click on a completely different widget all 3 table widgets will change color, but will change it again when they are clicked on to indicate that they are in focus. is there any way to achieve this which is fast so there's not a delay between click and color change... i tried doing it with signals and mousePressEvents but it still has some hick-ups, for example it changes the stylesheets regardless if the widget already has focus (every time it's pressed)... i tried implementing focusInEvent and focusOutEvent but it doesn't seem to work properly...
@subtle wing you can use root.tk.call('tk', 'scaling', 2.0) as well
specifying the library you're using could be helpful
pyqt6
ok
In PySide6, if I want to have an QComboBox with the possibility to also search via text completions,
What do I have to do to have the selected Item text actually show up in the box ?
Also: The completer activated signal does not seem to send out any useful data, it is always empty text and when querying the completer for the current index it is the default negative index.
Code:
class AntistasiFunctionSelectComboBox(QComboBox):
def __init__(self, parent = None) -> None:
super().__init__(parent)
self.setEditable(True)
self.setFocusPolicy(Qt.ClickFocus)
self.setInsertPolicy(QComboBox.NoInsert)
self.pFilterModel = QSortFilterProxyModel(self)
self.pFilterModel.setFilterCaseSensitivity(Qt.CaseInsensitive)
self.pFilterModel.setSourceModel(self.model())
self._completer = QCompleter(self.pFilterModel, self)
self._completer.setCompletionMode(QCompleter.UnfilteredPopupCompletion)
self.setCompleter(self._completer)
self.lineEdit().textEdited.connect(self.pFilterModel.setFilterFixedString)
self.currentIndexChanged.connect(self.on_index_change)
def on_index_change(self, *args):
self.setEditText(self.itemData(self.currentIndex(), Qt.DisplayRole))
def setModel(self, model):
super().setModel(model)
self.pFilterModel.setSourceModel(model)
self._completer.setModel(self.pFilterModel)
def setModelColumn(self, column):
self._completer.setCompletionColumn(column)
self.pFilterModel.setFilterKeyColumn(column)
super().setModelColumn(column)
In the on_index_changed, I tried self.setCurrentText, self.lineEdit().setText(), only thing that somehow works is self.lineEdit().setPlaceholderText(), this tells me the lineedit immediately looks for new input. How can I change it so that the lineedit only kicks in when the widget is actually selected?
please reply with ping
Extra: I also tried doing nothing with signals and letting the internal Qcombox handle the completer, nothing really changed(not sure), which gives m the fear something internal could be overwriting my attempts, but I cant seem to find out from the Docs.
Also: If I start writing text and then select an completion, even the text I have already written gets cleared.
Python: 3.10.1
Pyside6: 6.2.2.1
images of the problem.
Last image is the wanted behavior
||Sorry for multiple messages, had to split because of char limit and also wanted to provide more info with pics!||
is there any way i can make tkinter less "windows 95" like? btw pyqt5 isn't an option because i want to make my app windows compatible
Yes, you can style tkinter apps, though I don't see how using Qt would make your app incompatible with windows
Using ttk widgets, also styling them with ttk.Style()
qt should be compatible with linux windows and macos
Anyone here familiar with the Blessed or Blessings module?
You could use eel
It's cross platform
https://gist.github.com/97a1be6c71a48000710a852dd5b65200
In this gist, after clicking enable, the window stops responding
i want it to stop doing it's function as soon as i click disable button
I am making a currency converter using tkinter, and I want to place those labels("from:" and "to:") next to the dropdown menus. All widgets are placed using pack(). Rest of the design needs to remain the same, only the labels need to move. Any idea on how to do that?
Instead of using .pack()
You can use .place(y=,x= )
And just set the coordinates
how to change tkinter entry state after clicking checkbox?
I tried that and it worked, but the problem arises as soon as I try to resize the window
use grid
Frame was placed using place(), so using grid throws an error, is there a way to work around it?
no, place can be mixed with grid and pack
entry.config(state='disabled')
This is my code
and the problem is
whenever i click the tkinter button
it stops responding
Don't mix grid with pack(), I suggest to just use grid(). Also if all those widgets are in the frame all you have to do is to use column and row to place widgets next to each other. Or just take them out the frame and use .place(), but if you move the frame those widgets won't move with it.
is your app freezing once you click the button? maybe you need to run the iteration in a separate thread
ok i did that
Hello, I'm a newbie here, what is the simplest framework to build an interface would you recommend me to study?
Tkinter
I'm a bit bias since Tkinter is all I use, but you can also look into https://pysimplegui.readthedocs.io/en/latest/
None
its only code? or have some place to draw the interface?
It's only code, but if you're looking into drag and drop than you can look into PyQt, but that's a bit more complex
I see, it is a standard python library
Yeah
If is free, a could give a try
Im gonna have a look, thanks
its not free?
I see 😛
np means, no problem?
yeah
thanks mate, leaving now, see you
I wanna make a radius X around a point A ( point location will be given) and another circle on point B and find the unison between them. and shade the in-between.
What would be my best bet?
so i'm using pyqt and i have 3 table widgets and i want to change the color of them once they lose focus, like when you click on one, the other two will change color of the selected row to indicate that they aren't focused rn, also if you click on a completely different widget all 3 table widgets will change color, but will change it again when they are clicked on to indicate that they are in focus. is there any way to achieve this which is fast so there's not a delay between click and color change... i tried doing it with signals and mousePressEvents but it still has some hick ups, for example it changes the stylesheets regardless if the widget already has focus (every time it's pressed)... i tried implementing focusInEvent and focusOutEvent but it doesn't seem to work properly... does anyone have any idea how to make it instantaneous?
the lag between click and stylesheet change is especially visible when tables have a lot of items (around 300) and when those items are custom (custom labels)
i'd really appreciate some help
can u tell me why self.texture_size on a MDLabel :
MDLabel:
text: "Wertgutschein"
size_hint_y: None
size: self.texture_size
leads to the following spamming Warnings?:
[CRITICAL] [Clock ] Warning, too much iteration done before the next frame. Check your code, or increase the Clock.max_iteration attribute
[CRITICAL] [Clock ] Warning, too much iteration done before the next frame. Check your code, or increase the Clock.max_iteration attribute
[CRITICAL] [Clock ] Warning, too much iteration done before the next frame. Check your code, or increase the Clock.max_iteration attribute
[CRITICAL] [Clock ] Warning, too much iteration done before the next frame. Check your code, or increase the Clock.max_iteration attribute
[CRITICAL] [Clock ] Warning, too much iteration done before the next frame. Check your code, or increase the Clock.max_iteration attribute
[CRITICAL] [Clock ] Warning, too much iteration done before the next frame. Check your code, or increase the Clock.max_iteration attribute
[CRITICAL] [Clock ] Warning, too much iteration done before the next frame. Check your code, or increase the Clock.max_iteration attribute
I posted this in the general channel , but figured it might apply here also:
I posted in #help-kiwi about a weird problem I'm having when using the blessings TUI module - I am super new to python so it might be a simple issue - but I am perplexed and about ready to give up! Hoping someone who is familiar with it can have a look and at least point me in the right direction...
so i am getting elements from pyqt table widget, and its expected to be widget, but i made a subclass of a widget which has custom methods, but pycharm thinks its an error beacuse it thinks it got a QWidget and not my subclass
self.table_widget.cellWidget(i, 1).set_transparent()
where set_transparent() is custom method
and pycharm underlines it
is there any way to type hint that so that it doesn't think its an error or should i just ignore it
typing.cast(typ, val)```
Cast a value to a type.
This returns the value unchanged. To the type checker this signals that the return value has the designated type, but at runtime we intentionally don’t check anything (we want this to be as fast as possible).
thanks! it worked perfectly :D
do you guys have any "about us" design for my software ? its dark grey and purple, thank you < 3
Hey can someone help me rq I just need to know how to change input text color in terminal
for example
jaja = input("Name: ")
when i input my name i want it to be yellow (only the text i type to be yellow)
hey im new to python and i was wondering if there was a built in gui like how java has joptionpane
Tkinter
You can use Coloroma, termcolor or ansi escape sequences
Thank you
hows the colors
I like them.
Looks like its freezing cold at your place.
What is the general consensus on the declaration of widgets within classes in PyQT? Is it better to declare them within the init() function as instance variables, or to declare them in init() as method variables?
as in
class Window:
def __init__(self):
self.widget1 = QWidget()
self.widget2 = QSlider()
layout.addWidget(self.widget1)
layout.addWidget(self.widget2)```
as opposed to
```py
class Window:
def __init__(self):
widget1 = QWidget()
widget2 = QSlider()
layout.addWidget(widget1)
layout.addWidget(widget2)```
just pretend layout was defined there 😅
Hi! I'm trying to get into Qt licences.. There is a paid commercial licence, and there is also a LGPL for PySide. Is it true that I can use PYSide6 for a commercial desktop app for free without opening source files?
If so, It says there is almost no difference. So why anyone may want to use PyQt?
it's older, and I think the development was more stagnant for a while
guys how would i make a tkinter button add 1 to some var?
you can use pyside in proprietary apps, but the users of the app should be change the lgpl'd dlls your app is using with their own
Not exactly understand what you mean.. They should be able to change Qt libs for my app when it is already an executable?
Yes, so if you import pyside, they should be able to change that pyside for their own version (and same for the Qt dlls)
you either distirbute it under lgpl as OSS, or
Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version.
Not sure how to make it properly.. The only idea I have is to load pyside lib dynamically, so you can swap it. And everything else is converted to an exe file..
don't distribute everything packed into a single file the user can't unpack themselves, but for example do a zip where they can change out the dlls and the (compiled) python code
or I guess you could provide some way to build the app against a different pyside, but I assume you'd want to do that without distributing your source too
Pretty weird license.. But I guess there is no choise.. I've tried to use tkinter, but it's functionality is pretty basic.
anyone knows?
Im not sure if the practices im using are making my code messy
In your code, does the Window class does inherit QObject/QWidget?
You mostly go with the first version
The only time you shouldn't is when the widgets/layouts are inserted into a layout that is the layout for self.someWidget
You'd have a hard time using signals/slots and accessing the widgets created in the second version. So unless they are static, go with version 1
yes it does
i suppose we oculd assume it inherits QMainWindow
I see
thank you!
wdu mean
so if i have a layout, widgets that I plan to add to tht layout shouldnt be attributes of Window?
Yeah sorry, that wasn't super clear.
If you have a container widget that is self.container, and in the container you have 2 static widgets(that you don't need to access for any reason) then its okay if you choose not to create them using self.
just ask yourself if you will ever need to access the widget after its created for any reason. If the answer is yes, use self. If you wont, then either way is fine.
There are some cases where this isn't possible though. Like if you are creating 10 widgets in a for loop that you need to be able to access.
If you run into that situation, store them in some instance level container and access them from there.
i see
thank you, i got it now!
Hi, I am working on a CLI application which takes some commands as input. Is there any way I can scroll through those commands using the Arrow Up and Arrow Down Key?
depending on the terminal/framework if any there may be a history you can scroll through, if not you'd need to maintain one yourself
Yes, I am maintaining one myself. But how to scroll?
class collections.deque([iterable[, maxlen]])```
Returns a new deque object initialized left-to-right (using [`append()`](https://docs.python.org/3/library/collections.html#collections.deque.append "collections.deque.append")) with data from *iterable*. If *iterable* is not specified, the new deque is empty.
Deques are a generalization of stacks and queues (the name is pronounced “deck” and is short for “double-ended queue”). Deques support thread-safe, memory efficient appends and pops from either side of the deque with approximately the same O(1) performance in either direction.
Though [`list`](https://docs.python.org/3/library/stdtypes.html#list "list") objects support similar operations, they are optimized for fast fixed-length operations and incur O(n) memory movement costs for `pop(0)` and `insert(0, v)` operations which change both the size and position of the underlying data representation.
this all seems so complex to me lmao
Hello there my apologies for disturbing, i wanted to know if anyone was familliar with the cmd2 library i am in need of advice i thank you very much ^^
As far as I know that's not a UI library
It is. it isn't a GUI but it is a UI used in shell to create menu similar to terminals
hey guys can i ask a question relating to kivyMD?
how to make a qpushbutton as below in pyqt?
You need to set the text and then the icon, setIcon(QIcon()) setText()
i mean the icon alignment is different from the text alignment
Go ahead
bascially I'm new to kivyMD
so i have this table details which I'm importing from mysql my question is how do i import this values in .kv file
self.data_tables = MDDataTable(
use_pagination=True,
check = True,
rows_num = 8,
column_data=[
(" Sr.no ",dp(50)),
(" Weight ", dp(50)),
(" Price(in rupees) ", dp(50)),
],
row_data=billings_detail,
elevation=2,
code in .py format
Yeah, me .. LOL
hi so I was building a qt application using qtdesigner so I got the designs ready for different pages eg: login, dashboard etc. so when I click on a button I want to switch the page how do I do that?
Maybe , there is an event attribute or function u can use in qt
anyone good at selenium here to help me in #help-pancakes please
I tried looking it up but the only thing I found was stackedWidget which does not feel right so i wanted to know how the other people who have used qt do it.
Sorry, I cant help... i hope you find the solution
I have an idea, maybe upon clicking the button put a code thay could clear the window and substitute it with the page(window) you want, i use this approach in my projects...
this is what im doing right now but i hope theres a better way
Yeah i hope so, there is a better way .... doing such approach is tedious though... , i think u can complete ur project,.... u can do it, but rest is essential too in a project... i have to sleep now... good night...
😘
🥱
Hi everyone, I am currently making a python project with tkinter, and I was wondering if I can link a Scrollbar to a frame widget (I looked on internet there was no mention of this...). I expect it to look like this:
import tkinter as tk
fen = tk.Tk()
f = tk.Frame(fen)
f.pack(side = "left")
s = tk.Scrollbar(fen)
s.pack(side = "right")
for i in range(1, 100):
#create a line with a label and eventually several buttons
#in the the frame I named f
#and here is my question, what do I need to do to
#link the scroll bar to my frame with all the buttons
fen.mainloop()
have you got help?
nope
So to have multiple pages you must use QStackedWidget
ok so that is the best way?
yes
yeah that disappears once you finish designing
it only shows in QtDesigner so you can switch pages easily
ahh i see makes sense
once it is a python file it will not be there
ok
one more question
once i convert it to code it isnt in a format where i can run it directly right?
do I have to add something?
cause when i ran it nothing happend
def window():
app = QApplication( sys.argv )
win = myWindow()
win.show()
sys.exit( app.exec_() )
window()
they did this in a tutorial i was watching but qt comes without this
so ig i have to modify the code slightly?
what tutorial are you using?
That is incorrect
ok
let me send the correct code
if __name__ == '__main__':
app = QtWidgets.QApplication(sys.argv) appctxt = ApplicationContext() MyWindow = MainWindow() MyWindow.show() sys.exit(appctxt.app.exec_())
@naive monolith I'm on a phone right now so this is formatted incorrectly but that's the code
ahh np
make sure to change the variables to fit your code
thanks for the help man
anyone?
someone pls help
Sorry mate, I cannot help you there. I use kivymd rarely and have forgotten most of it.
This is possible but not in the usual way
I had to make a class object called scrollable frame and only then could I bind a scrollbar to the frame
I'll send you the code for the class if you want.
no problem man i solved that part anyways thanks for replying
Okay!
someone plz help
thanks a lot, I think it will be ok, and if I need the code I come back to you^^
thanks
np, just saw that and thought might me good to r eport to u
hi
In ttk.CheckButton, if I use the state() function on it, it will gimme the onset/offset values I have set, right?
.
Does 'Adobe Xd' help with PC applications' UI ? and i mean i am pretty sure i am very very wrong but my other solution without that would be changing pictures of buttons on hover, clicking and other actions... which is again wrong imo, is it not ?
i am just starting with UIs so i am a little lost or you could say very very lost
@storm flare
i dont work with UI
ok
is it me or creating GUI for python is quite a pain in the arse?
sorry man I just got into gui and i'll probably quit in 5 minutes
what are you using
i'm looking tkinter and pysimplegui
but you know I come from graphic design, where everything is basically drag and drop LMAO 😄
Any lib suggestions for UI better than tkinter?
pyqt
Hello, which version of pyqt should I use? 5 or 6 or it doesn't matter?
anyone know if its possible to have a holographic looking display with tkinter
I dont think so.it would allow you to set the state of the button.
What do you mean?
You could always couple it with ttk and create your own styles
Something like this where the light of each item can reflect onto each other
So how to see if a checkbox is ticked or not?
I highly doubt it
You have to look at the 'variable' portion of it
is tkinter the best for just a more basic UI then?
Ah okay thanks
yes
But you can do more complicated stuff as well
If you are willing to make custom widgets then you might be able to achieve the holographic look you want
So is it necessary to assign it to a var? Can't I normally do state = button.variable or smth?
It depends on what you want to achieve. You might also be able to make do with using the command option
Well, I want to make a check box which, is like sort of an accept ToS thing. I want to move forward only if the box is checked... I have everything else setup and working, just the check isn't working
Also if you scroll down then you can see this for state:
In ttk, there is no option with this name. The state mechanism has been generalized; see Section 50.2, “ttk style maps: dynamic appearance changes”.
Okay... I was just using ttk since I can use the same style in every component (sorry, it's been an year since I have used tkinter)
I think it might work if you assign it to an tk.IntVar() which would probably change between 0 for off and 1 for on
Well I set the on and off value to True and False respectively
you have a lot more examples in qt5 and it would be easier to start, qt6 is not complete yet and there are still some parts of it that will have to be updated from qt5
There aren't that many differences that examples wouldn't work between the two most of the time, and while I'm not sure if module parity is there yet, most modules are usable now
For something new I don't see that much of a reason to not use Qt6, you'll need to move to it in a bit anyway
is there any "wysiwyg" way to create gui for python app?
import tkinter as tk
class DatabaseApp(tk.Tk):
def __init__(self, *args, **kwargs):
tk.Tk.__init__(self, *args, **kwargs)
class DatabaseApp(tk.Tk):
def __init__(self):
super().__init__()```
What is the difference between these 2 ways to create an app class and which is the good one ?
Qt creator or designer.
They're both calling the __init__ method of the tkinter library, so they should result in the same outcome. However IMO, the second one makes more sense. The DatabaseApp class is inheriting the methods within tkinter, and thus you can just use super() to call __init__ without having to directly specify the parent class.
@dusky socket okay thanks !
How can i use while loop in tkinter?
Ive gone through the docs multiple times along with many SE threads. Having some trouble with shortcuts in pyqt5.
Are shortcut events essentially keyPressEvents?
Ive set te shortcut context to allow for the shortcut work application wide, except nothing really comes of it.... I figured it might be due to the widget I have fo\cused handling the event on its own. Do widgets implement a special handler for shortcut events or are they handled inside keypressEvent?
How do I implement subclasses using wxPython's form designer?
I've been looking through docs for a while now
Hey @slow thunder!
You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.
need help for interface car control
while x == True:
tk.Button(parent, text = f"{text}", command = lambda x = x: comd(x)).pack()
# after some time
x = False
can someone help me with pysimplegui?
def show_image(name):
file_name = f"./images/{name}.png"
graph = sg.Graph(canvas_size=(1280,720),
graph_bottom_left=(0, 720),
graph_top_right=(1280, 0),
key='-GRAPH-',
enable_events=True)
img_layout = [
[graph]
# [sg.Image(key="-IMAGE-", enable_events=True)],
]
img_window = sg.Window(name, img_layout)
while True:
event, values = img_window.read(timeout=50)
if event == "Exit" or event == sg.WIN_CLOSED:
break
try:
im = Image.open(file_name)
with io.BytesIO() as output:
im.save(output, format="PNG")
data = output.getvalue()
graph.draw_image(data=data, location=(0,720))
except Exception as e:
print(e)
print(event, values)
img_window.close()
this should create a graph on my window and draw an image over it, but it doesn't
it just is a blank screen with the graph on it
and there aren't any errors that would indicate im doing something wrong
Someone plz help
Note: the icon alignment is different from the text alignment
Okay so I think I need some help with tkinter
Or logic help?
name_var = name.get()
age_var = int(age.get())
number_var = number.get()
address_var = address.get()
amount_var = int(amount.get())
time_var = int(time.get())
tos_accepted = tos.instate(['selected'])
print(tos_accepted)
client_id = "".join(choices(ALL_LETTERS, k=20))
if (
not name_var
and not age_var
and not number_var
and not address_var
and not amount_var
and not time_var
and not tos_accepted
):
return
For some reason the if statement isn't working
I am missing something here ig
What are trying to do here?
Sorry, I don't know anything about pyqt
So I got a few entry components (those all are, except the tos one, which is a check button), and I am just trying it to return (not process) further if any of those is empty or smth
But if I skip any one of those, it still processes
Okay ik something here is wrong with my logic
Wait
Its working now
Black messed up big time rip
It added the not inside the bracket, it should have been outside it
Sadge, i asked tiz for bout 2-3 days alr
import tkinter as tk
class A (tk.Frame):
def __init__(self, parent, controller):
tk.Frame.__init__(self, parent)
self.subject_id = tk.Entry(self)
def get_subject_id(self):
subject_id = self.subject_id
return subject_id
class B (tk.Frame):
def __init__(self, parent, controller):
tk.Frame.__init__(self, parent)
self.subject_id = A.get_subject_id()
how can i get the subject_id of class A please ? this is not working
u need an instance of class A since the subject ID is an instance variable
okay thanks
I have encountered a problem, I can't figure out how to add another option with a button.
I'd like to create as many disease as the USER want. This is what the interface look like. Any help is appreciated. This is python, tkinter. My add disease button is not working (I can add only one disease + I can't 'remember' my output disease)
class InsertSubjectDiseasePage(tk.Frame):
def __init__(self, parent, controller):
tk.Frame.__init__(self, parent)
self.disease_label = ttk.Label(self, text='Disease', font=NORM_FONT)
self.output_disease = ttk.Label(self, text='', font=NORM_FONT)
self.disease_var = tk.StringVar()
self.disease_var.set('')
self.disease_label.grid(row=7, column=0, pady=10, padx=10, sticky='e')
self.output_disease.grid(row=7, column=5, pady=10, padx=10, sticky='e')
#show entry
self.disease_drop = ttk.OptionMenu(self, self.disease_var, *DISEASE, command=self.option_disease)
self.disease_drop.grid(row=7, column=1, columnspan=2, pady=10, padx=10, ipadx=50
self.more_disease = ttk.Button(self, text='Add disease', command=self.add_disease)
self.more_disease.grid(row=20, column=0, padx=20, pady=20, sticky='sw')
def option_disease(self, *args):
self.output_disease['text'] = f'You selected: {self.disease_var.get()}'
def add_disease(self):
self.disease_label = ttk.Label(self, text='Disease', font=NORM_FONT)
self.output_disease = ttk.Label(self, text='', font=NORM_FONT)
self.disease_var = tk.StringVar()
self.disease_var.set('')
self.disease_drop = ttk.OptionMenu(self, self.disease_var, *DISEASE, command=self.option_disease)
self.disease_label.grid(row=9, column=0, pady=10, padx=10, sticky='e')
self.output_disease.grid(row=9, column=5, pady=10, padx=10, sticky='e')
self.disease_drop.grid(row=9, column=1, columnspan=2, pady=10, padx=10, ipadx=50)
@unkempt jewel aren't you overwriting the disease each time?
Unless there is a new instance of that class for each entry
I need a hand too.
I want to use non modifier hotkeys for my tkinter program, but I want to disable them whenever a text entry is active.
However, it seems that when I bind them to my program, the text entry is the thing firing the event anyway
@gilded sable indeed they are in the same class
I should create a nested add_disease function ? like add_disease1, add_disease2 etc... so it doesn't overwrite ?
I am trying to create a user interface(UI) using bokeh and flask such that the UI front-end has plots that will be rendered dynamically and data will also be shown dynamically, based on the start/stop/back button provided in the UI (basically, its an optimization algorithm that I want to pause and play during its each iteration run, and the intermediate plots and solutions are to be rendered on the web). Is there a way to achieve this using flask and bokeh? Also, since I want a back and forth type of interactivity, what sort of database would be suitable for storing user data such that when the back button is clicked by the user, previous plot and data should be rendered.
Hey guys! Where can i learn the pktinker module in python??
I need to make gui for my project
I wouldn't use that module
PyQt is better
and easier
I know python basics only
I have a project in which i have to make a basic GUI
Would you still recommend PyQt? If yes where can i learn? Thanks
If you only know basic python why is your project to make a UI
Can’t argue with school 😂😭😭
Has your teacher forced you to use Pktinker?
Wow!! That would be easier ig
yep
search for tutorials
Youtube?
Sure
Thanks a lot!!
also
Yes
The easy way to create desktop applications. PyQt is a Python library for creating GUI applications using the Qt toolkit.
You are a blessing 😭🙏🏻🙏🏻
I am a PyQT newbie and trying to make a GUI that runs some pre-existing scripts I have.
Setup: scripts in conda env A and PyQt in conda env B.
Right now I am doing something like:
self.p = QProcess()
...
self.p.start("python",
['../dir/script.py', 'arg1', 'arg2'])
That snippet gets executed in env B, where PyQT is, but apparently it is missing some libraries of env A, when executed. Is there a way to activate env A, inside the QProcess, or what are the alternatives?
# Imports Start
import discord, rich, os, fade, random
from discord.ext import commands
from rich.console import Console
from win10toast import ToastNotifier
if os.name == 'ns':
toast_noti = ToastNotifier()
def clear():
os.system('cls' if os.name == 'nt' else 'clear')
nl = "\n"
def banner():
colors = [fade.blackwhite, fade.greenblue, fade.purpleblue, fade.fire, fade.purplepink, fade.fire, fade.water, fade.pinkred]
banner = random.choice(colors)("""
▓█████▄ ▄▄▄ ▓██ ██▓ ██████
▒██▀ ██▌▒████▄ ▒██ ██▒▒██ ▒
░██ █▌▒██ ▀█▄ ▒██ ██░░ ▓██▄
░▓█▄ ▌░██▄▄▄▄██ ░ ▐██▓░ ▒ ██▒
░▒████▓ ▓█ ▓██▒ ░ ██▒▓░▒██████▒▒
▒▒▓ ▒ ▒▒ ▓▒█░ ██▒▒▒ ▒ ▒▓▒ ▒ ░
░ ▒ ▒ ▒ ▒▒ ░▓██ ░▒░ ░ ░▒ ░ ░
░ ░ ░ ░ ▒ ▒ ▒ ░░ ░ ░ ░
░ ░ ░░ ░ ░
░ ░ ░
""")
Console.print(banner, justif="center", end="")
# Imports End
doesn't gets printed out
what?
can someone help me up
@digital rose you missing an import also this is not UIs
I am going through a code and there is a code line which I haven't understood:
Entire code:
from tkinter import *
window = Tk() # Initialising the window
def setWindow(): # Fixing the window size to full screen
width= window.winfo_screenwidth()
height = window.winfo_screenheight()
window.geometry("%dx%d" % (width, height))
window.minsize(width, height)
window.maxsize(width, height)
setWindow()
window.mainloop()
Code line I didn't understand:
window.geometry("%dx%d" % (width, height))
If someone could help, that would be great
!e print("%dx%d" % (200,1000))
@tribal path :white_check_mark: Your eval job has completed with return code 0.
200x1000
It's old(est) style formatting
oh okay thanks
you guys should check out tkinter codemy.com
its an amazing youtube channel
all you ever need to know bout python, for free
(not self promotion btw...i just recommend it)
I'm generating a dynamic grid of buttons in tkinter. It's based on subdirectories in a directory, each subdirectory gets a button.
Since there can be quite a large number, I've got a pretty fingerpaint-tier way of just putting them into columns with tk grid. But I'm wondering if there's a better way to dynamically arrange a grid of buttons.
Especially since the window can be resized and I want it to nicely fit in there.
I guess I want vertical wrap. 
You could always put the buttons in a separate frame and pack the buttons into it. That is what I prefer doing 😂
@ripe shuttle will that give me columns when nessecary?
It does not 
where do I import ApplicationContext() from
I'm trying to create a simple UI with 5 boxes (each box has can get a character by left clicking the box and entering a character), and boxes should be right clickable to cycle through three colors. There should also be a submit button at the bottom of the form. What should I use for this?
5 boxes are lined up left to right at the top of the screen, and submit button is under boxes
@modern tiger do a web front end and save yourself the trouble
.geometry() sets the width and height of the main window
Its a very old style of formatting... used in C blah blah
Where can I find good documentation for pyqt ui and networking
Instantiate the console first,
also it is justify not justif
||second to last line and last line changed||
# Imports Start
import discord, rich, os, fade, random
from discord.ext import commands
from rich.console import Console
from win10toast import ToastNotifier
if os.name == 'ns':
toast_noti = ToastNotifier()
def clear():
os.system('cls' if os.name == 'nt' else 'clear')
nl = "\n"
def banner():
colors = [fade.blackwhite, fade.greenblue, fade.purpleblue, fade.fire, fade.purplepink, fade.fire, fade.water, fade.pinkred]
banner = random.choice(colors)("""
▓█████▄ ▄▄▄ ▓██ ██▓ ██████
▒██▀ ██▌▒████▄ ▒██ ██▒▒██ ▒
░██ █▌▒██ ▀█▄ ▒██ ██░░ ▓██▄
░▓█▄ ▌░██▄▄▄▄██ ░ ▐██▓░ ▒ ██▒
░▒████▓ ▓█ ▓██▒ ░ ██▒▓░▒██████▒▒
▒▒▓ ▒ ▒▒ ▓▒█░ ██▒▒▒ ▒ ▒▓▒ ▒ ░
░ ▒ ▒ ▒ ▒▒ ░▓██ ░▒░ ░ ░▒ ░ ░
░ ░ ░ ░ ▒ ▒ ▒ ░░ ░ ░ ░
░ ░ ░░ ░ ░
░ ░ ░
""")
console = Console()
console.print(banner, justify="center", end="")
Is it normal for QMenuBars to draw over other widgetsin PyQT5 like this?. The vertical widget to which the power button belongs to is a vertically oriented toolbar. The rectangular widget is a QTextEdit
I read a lot on Google etc. But I don't understand it right. If I plan to sell my application made with pyqt I have to buy a license from qt for 180 per month and a commercial license from pyqt for 550? That's around 2700 in the first year. Is that correct. Pls prove me wrong
No that's incorrect
that's for Qt Commerical
PyQt is completely free to use and to publish and sell
is allowed
@kindred mist
It'll have to be OSS through GPL though
Why have pyqt then a commercial licence?
For proprietary software
you can sell what you made with gpl as the open source software, but anyone who buys it can redistribute it however they want as long as the license is followed
pyside is under lgpl for a more permissive license
So if I sell my software I have to deliver the whole source code with it, then I can use it for free
And if I sell my software without source code I need both commercials?
you would need it with pyqt
if you used pyside you'd only need the commercial license under certain circumstances, otherwise if you follow what the license says you can incorporate it in proprietary software
Yeah you probably were looking at Qt for C++ or PySide licenses
Hmm, OK, I think they should clarify this more on his pages. On pyqt page say u need a qt licence and a pyqt licence to comercial use (no gpl)
But it's no problem to use it under gpl so, it's OK
are you sure you're looking at the Pyqt license?
make sure it's the riverbank computers website
i am using tkinter and I want the user to be be able to selecft the folder that they want to save something in, how should i use tkinter to do this?
https://docs.python.org/3/library/dialog.html#native-load-save-dialogs you would probably be interested in filedialog.askdirectory
ty
@unique forge yes its on the riverbank side
@unique forge PyQt does not include Qt itself. You must also obtain an appropriately licensed copy (either the commercial version from The Qt Company or the LGPL version from the Qt Project). (FROM PYQT WEBSITE)
if i am creating a basic app with tkinter how should i organise and position widgets
However you want :)
as in with what system co-ords packing or grid or something like that
I would say using grid
Hello all, looking for recommendations on simple graphical packages to plot network devices and their physical connections on
I've written a script that can log into any number of devices and pull their CDP/connection data. This tells me a few key pieces of info: remote/local port, remote/local hostname, model, etc. I am currently saving all of this data into a nice dictionary/yaml format and would like to know what my options are to graph this automatically
For anyone curious, I found a sweet module called 'N2G' that helped me with this task.
A good reference example I found was at https://bitstudio.dev/drawing-network-topologies-in-python/
can anybody help me
Put True instead of the 1s there
wow ur making an actual game!
yes im trying
but the text cannot show up
Hello, anyone here?
What do you mean?
is it possible to change the color of the tittle bar if so then how exactly also i have a simple script here if u want that : ```py
import sys
from PyQt5.QtWidgets import *
from PyQt5.QtWebEngineWidgets import *
from PyQt5.QtCore import *
class Window(QMainWindow):
def init(self):
super().init()
self.setWindowTitle("Burner")
self.setWindowOpacity(0.9)
self.setGeometry(60, 60, 600, 400)
self.setStyleSheet("background-color: #19202a;")
self.show()
MyApp = QApplication(sys.argv)
window = Window()
MyApp.exec_()```
My problem is that the lineedit runs my command(): 2 times and I don't know why
class MainWindow(QWidget):
def __init__(self):
super().__init__()
self.setupUi()
def setupUi(self):
self.lineEdit = QLineEdit(self.groupBox)
self.lineEdit.setGeometry(QtCore.QRect(150, 0, 848, 86))
self.lineEdit.editingFinished.connect(self.command)
self.lineEdit.setFont(font2)
self.lineEdit.setLayoutDirection(Qt.LeftToRight)
self.lineEdit.setStyleSheet(".....")
self.lineEdit.setFrame(False)
self.lineEdit.setMaxLength(10000)
self.lineEdit.setEchoMode(QLineEdit.Normal)
self.lineEdit.setCursorPosition(0)
self.lineEdit.setReadOnly(False)
self.lineEdit.setClearButtonEnabled(True)
def command(self):
global html4
text = self.lineEdit.text()
self.lineEdit.clear()
search = re.search("^echo", text)
if search:
text_list = re.split("\s", text, 1)
print(text_list)
if len(text_list) > 0:
for i in text_list:
if os.path.exists(os.path.dirname(i)):
print(text_list[1])
head, tail = os.path.split(text_list[1])
name, extension = os.path.splitext(str(tail))
if str(extension) == ".txt":
with open(text_list[1], "r") as f:
file_context = f.read()
html4 = file_context
f.close()
elif search and len(text_list) > 0:
text_list = re.split("\s", text, 1)
html4 = text_list[1]
else:
html4 = text
html1 = '''<!DOCTYPE html>
<html>
<head>
</head>
<body>
<p style="color:'''
html2 = '''red'''
html3 = ''';"> '''
html5 = '''</p>
</body>
</html>'''
html_end = html1 + html2 + html3 + html4 + html5
self.lineEdit.clear()
self.textEdit.setHtml(html_end)
So if I type "echo E:\Documents\python\PyCharm\venv\CLI\ascii-art.txt" in my lineedit and press Enter, then it prints 2 times the context of "ascii-art.txt"
https://youtu.be/22IMWSUlrZg
There are a lot other tutorials of custom Title bar.
This is a tutorial series where we will be building a full Desktop App one component at a time. Subscribe so that you won't miss out when I upload other episodes.
In this part[3] we are going to build our main app window with a custom navigation bar in python using Qt Designer, Pyqt5, and Pyside2.
Download source code and source files from:htt...
Anybody here familiar with PyQt.QMediaPlayer?
I want to display a label on top of a video but the label have a background color and i am unable to remove that
using stylesheet
i want to remove the grey background-color it have
You can remove the title bar using
self.setAttribute(QtCore.Qt.WA_TranslucentBackground)```
And then can create a custom Title bar with your own styling and Minimize, Maximize, Close buttons
does anybody know how to go back to main screen after opening a table in kivyMD?
Thank you @digital rose and @broken shard sorry for replying late since timezones
Which do you think is the best python module for making GUIs cause I used PyQt its good but has its license stuff so planning to move to different one . . . for paid GUI apps can you help me here thanks
(PS: it mostly depends on if you're trying to build a web-based interface, or just a desktop application, and i'll be writing about options for the latter.)
if i talk of some appropriately documented lib, you'd be down to Tkinter, PyQt, and Kivy. out of these, Kivy has a huge hassle (plus, it does not seem to offer anything special, and doesn't seem to be great from an aesthetic point of view), you don't wish to use PyQt, and tkinter is actually decent (if you want to avoid the extremely vintage look, you can have a look at some custom tkinter themes available online, or write one yourself).
also, these libs do seem to have quite a decent community each, so it's highly likely that you'll find answers to common problems on online forums, like stackoverflow.
if you are not satisfied with any of these, then there's not much that python has to offer (as far as i know, or even if it does, it's most likely a third party project, and might not be well documented). so the best option would be to use some other language that might offer decent choices - for instance, if you're more into microsoft styled UI, you might want to use C#. other than that, JavaScript does seem to offer decent UI options too.
if you're still not satisfied, you might want to write a tiny project to draw widgets off of a graphics lib, like pygame, which would normally sound ridiculous, but it's not that hard / not that big of a hassle if you want a tiny project, where you would write code only for the GUI you want to exist in the app.
You might want to take a look at Dear PyGui. It has a permissive MIT license, i.e. free for commercial use, and looks more modern than Tkinter.
https://github.com/hoffstadt/DearPyGui/wiki/Dear-PyGui-Showcase
can somebody help me with this problem ^
the question was too big too post here
ye ok thanks
app.validate_user(Username.text, Password.text) what error are you getting specifically?
if ur worried abt the license use pyside
and the pyqt license only affects you if you decide to go commerce with a pyqt app
https://github.com/DivyanshuBist/sudoku/blob/master/Gui.py
is there any way of making the "WM_DELETE_WINDOW" work only on sudoku_frame only (LINE 53)
Also (LINE 12) was showing invalid syntax for inconbitmap
iconbitmap uses a .ico file as far as I am aware
ok thanks. I will check after changing
"WM_DELETE_WINDOW" only works on Tk and TopLevel I think so the Sudokuframe would either have to be a TopLevel or a Tk
Correct me if I am wrong guys
It's been two days I am trying to install kivy on windows 11. Tried Python 3.10 and Python 3.9
I used pip install kivy command
Anyone knows what I am doing wrong?
can you send error?
Can I get some inspiration from some nice UIs you people made?
the main point of a ui is to make thing easier so go for a simplistic design with the main idea being utility. personally I didn't create any thing that great so u could just take reference from the apps that u use regularly, hopefully this helps.
first do u have multiple version of python ? secondly did u add it manually to the system variables @uneven summit
Hey guys, I have a project idea in mind, wherein I want to create a GUI application using python to analyse stock market data, so it involves a lot of plotting graphs n all. But I am confused whether to start learning Tkinter and PyQt. From what I have searched it seems that Tkinter is easy to learn but is hard to debug and is not scalable and PyQt has a lot more functionality but has a steeper learning curve. Can somebody suggest me what I should start learning. Thanks in advance 🙂
You could check out Dear PyGui. It has plotting functionality built in.
hello. I'm having troubles recently with python 3.10 and wxpython 4.0.7.2-3. It seems to happens only in application with menues. Can you help me? Look at the images.
guys anyone here knows pyqt5 ?
Yes
Its kinda late but here what im currently building with PyQt5
Cool! Man, PyQt if powerful. I used Tkinter, and at it's default, it's ugly. Tkinter needs some tweaking to look nice
Take a look at pygal module. It renders a lots of graphs types.
Hello can anybody help me in php for quering data of one row from a mysql database?
Hello everyone ( i am new to this server sorry if i texted in a wrong channel)
I have a query regarding tkinter frames and winfo_children() function.
So for my Final year of high school project our group and i have decide to put together a banking system with Mysql connector and python (we have to use these two compulsorily so there is no alternative here) Now i am doing teh UI for my tkinter application and i seem to have encountered a little bit of an issue with how frames work.
def ClearPrevFrame(rootFrame):
Widgetlist = rootFrame.winfo_children()
rootFrame.pack_forget()
for i in Widgetlist:
i.destroy()
def RegisterPage():
# has relavant code for register page
ClearPrevFrame(menuFrame)
def Loginpage():
#has relavant cide for login pge
ClearPrevFrame(menuFrame)
#Root buttons
RegisterPage = Button(menuFrame, text = 'Register', command = RegisterPage).place(relheight=0.06,relwidth=0.2,relx = 0.56,rely = 0.1)
Loginpage = Button(menuFrame,text = 'Login', command = Loginpage ).place(relheight=0.06,relwidth=0.2,relx= 0.75,rely=0.1)
root.mainloop()
now the menuFrame is inside a Cavnas(named Kanvas) and what i want to able to do is clear the canvas or the frame everytime i press the buuttons
i tried using the winfo_children() function to get the data of all the widgets and then delete them induvidualy
but for some reason that dosent work as i have 0 widgets everytime i do it but i am able to clearly see the widgets on my tkinter screen
which causes this error
i am in urgent need of help to resolve this issue
it's important to determine where ClearPrevFrame is being called to know any further. the reason it shows 0 widgets might be because you used a geometry manager (for instance, place()) in the same line where you declare the parent widget. so,
Button(master, text="Button", command=None).place(x = 100, y = 100)
^^^^
would cause this button to become a NoneType object.
how can I restrict the Entry input to only numbers and float are allow for tkinter?
you'd need events. just bind keys to the entry widget, and on each keypress, check if the entered character is an integer, string, etc.
def on_key(event,):
# key = event.keysym # the name of the key you pressed
char = event.char # the character you tried to input
if char in "0123456789.":
pass; # do something
else:
# this statement disables the regular functionality of a key (temporarily)
return "break"
widget.bind("<Key>", on_key)
Ohh okay i will try to implement this fix and let yo know the result. Thank you for offering help
