#user-interfaces
1 messages ยท Page 60 of 1
i think its required
k
like in which window the icon must be placed
Hey @keen path!
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:
Pasting large amounts of code
If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pydis.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
oui
yup
Hello
No
k
i thought this was the main chat
ah k
hmm
hey
hey ๐
wassup
ehh nothing, i always check #user-interfaces #discord-bots and #game-development
i always check #user-interfaces and #game-development
cuz im a GUI dev
in other ways frontend dev
but im also obliged to do all the backend work too
since im not yet working in a company
ahh ok
man
i was making GUI earlier and it was working fine
but not idk why it is showing error
i have to submit a project by tommorow and idk what this error even mean
do mention me when u get to know wht error it is ๐ญ
@digital rose
hahayes very ez problem
img=ImageTk.PhotoImage(Image.open("D:\documents\cardsp\2H.jpg"))
Should be :
img=ImageTk.PhotoImage(Image.open(r"D:\documents\cardsp\2H.jpg"))
i just added the r before the directory
@radiant anchor do u need help ?
Hey,
can someone tell me how to set a frame size in tkinter to actually 0?
top_frame = Frame(window, height = 20, width = 100, bg = 'blue')
top_frame.pack_packpropagate(0) # disable rescaling
top_frame.pack(expand = False)
mid_frame = Frame(window, height = 0, width = 100, bg = 'green')
mid_frame.pack_propagate(0)
mid_frame.pack(expand = False)
bot_frame = Frame(window, height = 20, width = 100, bg = 'red')
bot_frame.pack_propagate(0)
bot_frame.pack(expand = False)
mid_frame is still at least 1 px high
there is a gap as shown here:
(the gap is the mid frame)
yes i do @keen path , sorry. took me a while to type
ok
ok
i just added the r before the directory
@keen path man thanks h lot bro ,someone in webdev answered me lol ,I am making blackjack game like the one we get with OWO BOT of discord
PyQt5, can someone help me out
I'm using tkinter scrolledtext to, well, scroll text. How can I allign this text to the centre of the scrolledtext label though?
Also, how can I have it automatically scroll?
sure @unique forge
So I created the pyqt5 design on designer then converted to py file
Ok
Normally I would edit that file and attach functions to buttons
But there was the issue of : if I wanted to change the gui design, it deletes all that stuff
So I'm trying to have a separate file for all the functions being attache to buttons
You are supposed to do that
yeah, I'm a noobie
It literally says at the top of the page dont add or make chanhes
I realised after watching a video of "what not to do"
Yeah
Cause whenever I attach functions to buttons, it doesn't even call them
I'm not even sure if the init function is getting called
I will share the code
BUT
The gui opens?
If the GUI opens, then the init was called
I put prints in it and they don't display
Send code please
Here you go my good sir
So I followed a guide for the main at the bottom but it didn't originally work
Is it possible to extract text from a game for instance, without saving the region as a screenshot?
yeah
You haven't used QMainWindow
from PyQt5.QtWidgets import (QApplication, QMainWindow,)
class MainWindow (QMainWindow):
I don't understand
You are using Clean_GUI
You need to use QMainWindow for it
So import QMainWindow
And make your class include QMainWindow
I sent it above
Also change def init
if __name__ == "__main__": app = QtWidgets.QApplication(sys.argv) MyWindow = MainWindow() MyWindow.show() sys.exit(app.exec_())
Finally, change def init
def __init__(self): super().__init__() self.ui = PTCGUI.Ui_MainWindow() self.ui.setupUi(self)
Replace PTCGUI with the name of the other file
Ui_MainWindow has no show attribute apparently
I'm using tkinter scrolledtext to, well, scroll text. How can I allign this text to the centre of the scrolledtext label though?
@unique forge It doesn't like it
Send the new code
clean_gui.py", line 77, in setupUi
MainWindow.setCentralWidget(self.centralwidget)
AttributeError: 'InvoiceGenWindow' object has no attribute 'setCentralWidget'
Dont import clean gui
but that's where the designer stuff is
@unique forge
File "/Users/user/Documents/Projects/MyProjects/invoice-generator/clean_gui.py", line 77, in setupUi
MainWindow.setCentralWidget(self.centralwidget)
AttributeError: 'InvoiceGenWindow' object has no attribute 'setCentralWidget'
Author Alan D Moore describes some common pitfalls of using QtDesigner with PyQt5, and the proper way to combine the two to build GUI applications.
Follow Alan at https://www.alandmoore.com
Purchase a copy of Mastering GUI Programming with Python here: https://www.amazon.com/Mastering-GUI-Programming-Python-cross-platform-ebook/dp/B07S9WFD92/
...
It doesn't say import the gui as a whole
just ui window
either wya
this tutorial doesnt work
I just get the same errors
@unique forge
Any idea why it doesn't work ๐
I think you need to start again
But dont delete the functions
But start a new file
Can someone help me with tkinter problems?
https://pastebin.com/xeSFMaDJ
idk why i get this error, im not using any pack, grid in the same frame
I'm working on a PyQt5 app, I want to implement something similar to the classic "File>New".
For the time being I'm triggering a function that resets every field to its default value but I think as the application is getting bigger this could be a lot of repetition in the code and the execution time might become an issue.
Is there a way to reistantiate the main window with an action?
what
Just add a menu bar, then connect the widget 'new' to the function you wanna call ? Done?
How can I stop a tkinter window from ever being the current focused window? it's always drawn on top of other things, but I'd like the applications below it to receive the click events.
Hey,
i created a Frame with tkinter.
The Frame has a height of 0.
When pressing a certain button the frames content gets created or deleted.
Even though the height is set to 0 the frame is about 1-2 px high on startup.
When content gets added the Frame will resize to fit its content as desired.
When content is deleted the Frame will stay it the size of the deleted content instead of scaling down to 0.
Can someone help me with this?
Note: When i readd content of a smaler size than the old content the Frame will scale down to fit the content, but when i remove all content it will stay at the size it was when it had content.
Can anyone help me out in #help-lemon
In PyQt5 is there a way to not remove focus from the active window when the GUI is clicked on?
Programs can still control it, in some way.
It's a matter of working out how, which I want to do.
Programs can control it
where did you read that
(look at the likes of msi afterburners overlay)
Clicking on the overlay doesn't affect the overlay at all
There's also others, msi afterburner was just the one I could think of off the top of my head
can you use python with java to create a ui?
Not with Java
@inland notch why would you use both when either one can do it alone?
Generally most people asking for help here are relatively well versed in python and as such will learn python modules easier than other languages
Nonetheless both are very capable, and I would personally recommend just using the one you're more experienced with
python for the computing, java for the ui
What about Tkinter ?
tkinter's slow
I'm making some scripts etc but Always get stucked when i have to UI'ze all
It's what i'm currently using, but it's really slow, and I think java would imporove the FPS
Videogames ?
yeah
I just want to develop some specific softwares
I know, but it's what I was using at the time that I got the idea to make a video game, so I made it with python, but it's slow so I want to use python in conjunction with java to improve fps
how can i stop kerning in tkinter labels?
i am trying to make an ascii art converter but this issue is really bothering me
i think a monospace font will fix it, but i havent found one yet
can anyone help?
ive tried a bunch but it overrides it somehow
Hey, How do i keep the position of the window same even though i changed the screen resolution?
Here's in 1360x768
And here's in 1920x1080
How do i keep that white square stay on the very edge of the screen like in the 1360x768 even if i changed resolution?
well first u havent specified what that is ( which module are u using )
good for very simple programs
What's the meaning of user-interface? Frontend?
Hello, is there any GUI library that can display opaque text with transparent window?
My Tkinter code is defined in frames in classes and I'd like the entire GUI to exit and restart when I press a button. It should do both simultaneously. ex, I press 'Restart', it should close the mainloop() and reinitialize
Any solution you suggest?
transparent window ?
i wish i could see that happen
@strange sable well it's possible https://stackoverflow.com/questions/19080499/transparent-background-in-a-tkinter-window
alr
have to do differently on each OS though..
@wispy zephyr@keen path
Yes, I did use that method but there's a problem
The color between text and background has a slightly different shade of color that doesn't get removed
Example, red & black text on white background
-transparentcolor white
I tried to make it smooth by making the BG 'the same' as the text color
By 1 different on RGB color (0,0,1) to (0,0,0) for example
It kinda works but still depends on the color, it's a bit bad on some color (pixelated or very thin)
I have a tkinter listbox with names, but I want the names to be sorted on alphabetical order. How can I do that?
Does anyone have an idea of how I can go about this?
Idk if i understand it correct but maybe make 1 main function for all the other functions
Sort the list before into feeding it into the listbox.
Create a restart function which destroys your existing window (also main function) and starts a new loop, given you have defined your mainloop as a function. Later you can direct the restart button tho restart function. Recursion is the best way to go about it.
Oh okay, understood. I'll give it a go right now and let you know
So, would I self.destroy() first and then call the main function?
@split ferry I did what you mentioned, and the program restarts correctly. But the first window does not close
I end up with 2 windows, but the 2nd one works as expected
def exitrestart(self):
self.destroy()
rerun()
def rerun():
if __name__ == '__main__':
app = MainWindow()
app.mainloop()
Give me a couple of minutes. I'll try this code and get back to you.
Sure
@vale orchid
import tkinter as tk
def main():
global window
window=tk.Tk()
window.columnconfigure(0,minsize=800)
window.rowconfigure(0,minsize=600)
button=tk.Button(master=window,text='Generate',command=okay)
button.grid(row=10,column=4,pady=15,ipady=12,ipadx=12,sticky='e')
def okay():
global window
window.destroy()
main()
main()
window.mainloop()
You can use the same logic. It works fine
Probably because your main window hasn't been shut down. Then again, without your code i cannot do much.
Makes sense, I'm trying it out
Okay
Umm, It's about 600 lines of code. Would you like to have a look at it?
Try the logic first. If it doesn't work, then share the code.
Yup
I'm having a doubt here. I'm using classes to define the frames. So do I have to move all the classes into a main() function and then try this logic?
Not really. Just initialize the classes within the main function
@vale orchid All the static code can stay outside the function, but all the working code has to go in. If your working code needs the class, then it has to go in
Yea. My functions are inside the classes that require it, so I'd have to shift my entire code inside main() I believe
Yea, exactly
if __name__ == '__main__':
app = MainWindow()
app.mainloop()
Only this bit would be outside I think
Am I mistaken?
what about app=mainwindow() line? you need to recreate it every time you click restart, right?
Yes
Ohhh, makes more sense now
This HAS to be inside the loop too, and then I can execute the logic you showed
yea. If you read the code i sent you carefully, i have called a new window in every recursive loop after destroying the old one.
So, you have to create a new tkinter window within the main() function
Welcome! I can feel your excitement lol
Oh you have no idea. I've been working on all the intricacies for a while now and to see it come together! Have a great day
Sure
@split ferry Thank you very much buddy! I'm working on the same project as @vale orchid and with your help I think we are almost done with our project!
@quasi atlas No problem. Good luck with your project.

can someone tell me is learning kivy worth it?
how powerful is it for mobile platform?
well first u havent specified what that is ( which module are u using )
@keen path oopsies, i use PySide2
ah, never heard of it
x = ""
def ok():
cfrom = cfromx.get()
cto = ctox.get()
val = inputtxt.get("1.0", "end-1c")
x = convert(cfrom , cto, val)
label1 = tk.Label(self, text=(f"Output: {x}"), font=LARGE_FONT)
label1.pack(pady=10,padx=10)
button = tk.Button(self, text="Convert!", command=lambda: ok())
button.pack()
button1 = tk.Button(self, text="Back to Home",
command=lambda: controller.show_frame(StartPage))
button1.pack()
so this is a snippet of my code using tkinter
i sorta need help on getting the output of ok() into the label1 "output: " to show the value, but im having trouble doing it. can someone help?
ping me if anyone answers pls
@bleak egret I'm not sure if I got your question right, but I assume you want to change the text in label 1 whenever you click Convert button.
If I'm not wrong, your 'x' within the ok() function is a local variable and it is not changing the default value of global x. Try adding a line "global x" within ok() and run it. If it doesn't work, then you can use label.configure method to directly change the text within the ok() function.
I tried that still doesnโt work
Global x?
Okay. There are resources on stack exchange in how to use it. Do refer them. Also, global x won't work if your label1 is not getting updated recursively
Ping me if it doesn't work. I'll write the logic and send it to you
ok?
ok?
do that in #ot0-psvmโs-eternal-disapproval
why
or another off topic channel
it's related to user interfaces no ?
I am using Qt designer and I want to press a button and a label will pop out. HOw do I do that?
hi @uncut pawn
so basically, you want a label to become visible when you press a button
just hide the label and when you press the button show it?
@bronze basin that isn't very helpful
at least tell him how to
anyway, you need to do self.ui.label.show and self.ui.label.hide and then connect it to a button, like so
self.ui.label.hide
self.ui.pushButton.clicked.connect(self.showbutton)
def showbutton(self):
self.ui.label.show
yeah I wasnt fully on my pc so didnt have time to post the code before you posted it haha
oh
ok
but last time your answer was wrong, you said that you can't use QT Designer for Commercial use
yeah that was my bad I thought he was talking about the module Pyqt itself and the code
because most people would want to know about the whole module instead of one specific software
in tkinter when i try to make the text larger the boarders of the gui get larger to, how can i make the text bigger and not the gui
i was trying to convert a ui file to py file since im using the qtdesigner and i want to see the code behind the window
it throws me an error
saying
C:\Users\user\AppData\Local\Programs\Python\Python37\python.exe: No module named pyuic5
I see
basically, you have to go to the path of pyuic5.exe @covert iron
and run the program there
h
i need very simple help with tkinter if anyone could help
@bleak egret , i want to make the text bigger on the gui but when i make the text bigger on the gui the gui boarders also get further away from the text, I can't find anyway to fix this
if i understood your question properly, you want to have text within closer borders?
i think that is right
i have a box touching the boarders of the gui that the text is in, so when the text gets bigger the boarder gets further away from the box and its like a box in the middle of the gui instead of the top middle touching all corners
try using padding spacing
like padx and pady
ill give you an example
hold on
label = tk.Label(self, text="Convert Currecncy here!", font=LARGE_FONT)
label.pack(pady=10,padx=10)
heres a project i did a while back, this adjusts the label padding area around it
this is what it looks like
(the top label)
import tkinter.font as tkFont
root = Tk()
root.geometry("420x260")
title = Label(root ,text="DGS, LLC Customer Sales Database",height=7, width=60, bg="grey",font=LARGE_FONT)
title.pack(pady=20,padx=20)
root.mainloop()``` is there something i am missing?
it is not getting larger
hold on
larger nos in padx and pady means it will get larger
try =100 to see a significant difference
and the relative scaling
i put it to 100 and it made no difference
i thought that was just a name
oh wait sorry
i thought there was a thing like a title tag when i saw yours
didnt realise it was a name
oop , well idk maybe my computer broken lol
then why do you have a height and width for?
why is it a small box in the middle for me
when i add padding it makes it super small and in the middle of the gui
what kinda witchcraft
i dont have a fixed geometry
not that that breaks stuff
but
try fullscreening your page
from tkinter import *
import tkinter.font as tkFont
root = Tk()
title = Label(root ,text="DGS, LLC Customer Sales Database",height=7, width=60, bg="grey")
title.pack(pady=100,padx=100)
root.mainloop()
so is that wrong?
this si what i get with your geometry
thats font siz then
try increasing font size
you know there is a screen shot function built into windows 10 right?
ah
and i dont have to save
how do i add LARGE_FONT= ("Verdana", 12) to my coe?
where have you defined LARGE_FONT
"veranda" is font name
12 is size
you can add it at the top
after you import everything
sorry i am confused how does largefont go with anything
i don't understand how i put it into my code
look at the to
p
this is a small part of my code
your already using it though
font = LARGE_FONT
there
in the lable
ping me if you need more help
i been looking everywhere and i don't get were you call the variable large_font to have it connect with the label
@bleak egret ,sorry for needing help so fast lol
its fine
i have it on the 5th line
import tkinter as tk
from cash import *
from tkinter import *
LARGE_FONT= ("Verdana", 12)
i mean when you add it to your label
at workeddd thanks]
font = LARGE_FONT
it
np
life saver
Hi @everybody#8793
Please check out this new text editor written in Python and GTK
https://gitlab.com/hamadmarri/gamma-text-editor
Your feadback and contribution is appreciated
Thank you
i made blackjack from tkinter
do tell me if i can improve
Great
can it show more than 4 cards?
i wanted to ask about tkinter why "def call_me():"when i creat thos line and conected it "form1 = Button (windows, text="test", command=call_me())" the def line show frist whitout even touching the button line
When you add () after a function, you call the function and assign what it returns, not the function itself
can i show you my work its relly simple mybe you can reveiw it
oh ok iam understand thank you kindly stranger
Yes, you may also have a text user interface for example
Graphical User Interface vs User Interface...
Guys, I've created a PyQt5 GUI - I'm using a certain font that isn't being applied when running the GUI on windows? any idea how to fix this? The font is "Segoe UI" - it's preinstalled on windows
Hellow. How can I bring the Menu written to the center? I am using tkinter.
Here's the code:
frame = LabelFrame(root,text=" Menu ",font=('Courier'),padx=100,pady=100)
frame.pack(padx=20,pady=20)
@midnight zealot You could try:
frame = LabelFrame(root,text=" Menu ",font=('Courier'),padx=100,pady=100)
frame.pack(sticky='n', padx=20,pady=20)
sticky='n' will do that thing?
Sticky represents the direction the widget gravitates toward. In this case, the text should gravitate toward the north of the gui
n represents north
Aight
This should help
_tkinter.TclError: bad option "-sticky": must be -after, -anchor, -before, -expand, -fill, -in, -ipadx, -ipady, -padx, -pady, or -side
:(
you can't use sticky with .pack()
try anchor=tk.N
I haven't used LabelFrames so I'm not sure what exactly would work.
if that doesn't do it, try anchor=tk.CENTER or anchor=tk.CENTRE
Actually I am new to Tkinter
I'm not new. I just haven't used the specific widget in tk ๐
Does that work, though?
Can you send the code
root = Tk()
root.title(" Menu")
root.iconbitmap(".\\ico\\Database.ico")
root.geometry("800x600")
root.resizable(0,0)
frame = LabelFrame(root,text=" Menu ",font=('Courier'),padx=100,pady=100)
frame.pack(padx=20,pady=20)
Here's the one I wrote
import tkinter as tk
root = Tk()
root.title(" Menu")
root.iconbitmap(".\\ico\\Database.ico")
root.geometry("800x600")
root.resizable(0,0)
frame = LabelFrame(root,text=" Menu ",font=('Courier'))
frame.pack(padx=100,pady=100, anchor=tk.N)
try it. Play with values and anchor directions a bit.
Didn't work
there is no difference
Same output
It's just changed the position of the frame when I use NE, S and all
try looking up on tkdocs.com or python documentation for tkinter. If nothing works raise a question on StackOverflow. Make sure using two tags python and tkinter. Me or probably Bryan, cool cloud or acw will answer that.
I get this on windows
The sizes and fonts are set to be the same... but they're not?
How can I get the program to behave the same across different os
Windows and Mac use different elements for GUI. for eg Mac creates a default menu bar for apps but windows doesn't.
I removed the menu bar
I just need it to display the same across different operating systems
that was just an example for difference of UI elements.
For a "cross-platform" gui library, tis a bit false in its claims
But you can't overcome OS limitations, right? Python is said to be cross-platform but there are so many things which change across platforms.
What widget is that anyways?
although It should not happen in this scenario.
So we have buttons, labels, (the image is technically a label object too), progressbar..
I was asking about the ProgressBar only.
and do you wish use the windows view or the view on the mac?
I got it now
Thanks
windows
but am using mac
Im using pygame to create a gui but the display isnt working, what can I do to fix it
does anyone know of a way to make a text box in tkinter have clickable hyper links? i have it using selenium to find these links and put them in a text box. https://gyazo.com/07dd018ca6d9d2f5d903b32c0bd8c8c9
or if it would even be possibly at all?
pygame is for games, not GUIs
is this good place to ask about speech recongnition
i dont think so
i am not trying to moderate, but since you asked, i think a better place wold be #python-discussion or a help channel
i need tkinter help
is there any way to make the background of a tk canvas transparent? i want to print text on it so i can see it on top of other application windows
@digital rose ask!
@unique forge , I have it so my tkinter gui button opens another tkinter gui but when i destroy the first one it doesn't work it just stays there and crashes if you press it
How are you exiting your tkiner window? It might be executing the whole GUI class in the terminal and not a singular window
It opens two different terminals, but i use example.destroy(), @upbeat nacelle
I have a feeling that when you use destroy, it stops the tkinter.init() and doesn't let you keep going.
everywhere i look on how to close it says destroy
i can't find a diferent way anywhere
Hi everyone! I'm not sure if this is the place to ask a question like this since it doesn't pertain to making a user interface.
I'm looking for tools to read a user interface.
I have two PySide 2 UI's Ive created and I have two buttons in a script which launches each of them. I want the second one's features to be disabled if the first one is active. anyone know how I can achieve this ?
is it possible to make a python file executable but not readable
no, like run a py file with python, but not read/open/edit the file
No
Hey! I want to start working with python UIโs but all Iโm wondering is where do I actually see the output?
Is there a window I havenโt found yet?
@tight sail its greqt
*great
I used QT Designer to make an app and it worked great
You should use QT Designer too
Heres the app
QT Designer made it a lot easier
what does it do?
i downloaded it
yoooo
@unique forge That actually a fucking awesome app
Has anyone here had experience with kivy? Ive started learning it but the float layout confuses me
also. have you made an android app with it?
Hey all so I'm using a slightly modified version of a custom pyqt5 widget I found for a custom EV dash display: https://github.com/StefanHol/AnalogGaugeWidgetPyQt
I just profiled my code, and although I have several dozen other labels, buttons, sliders, and progressbars, this one widget is responsible for 95.5% of the cpu time for the entire GUI, because when updating the value of the analog needle it calls self.update() which redraws the entire widget including static elements like the radial scale, scale text, scale markers, etc... the only dynamic element, the needle, requires just 2% as much time to draw as all these elements...
I realize I could get around this by just duplicating the widget to create a 'static' one with hidden needle and another 'active' one with only the needle visible. But there must be a better way to update just part of this widget? I've read repaint() should not be used directly.
Hmm even with those elements disabled, they are still being updated with self.update, so I'm not actually working around the issue. Seems I would have to fork it into two widgets, a static and dynamic widget to optimize speed while using the otherwise optimized builtin .update() method.
@amber kite thats a corrupted file ๐ u cant program it. U just corrupt a file, and lo its not readable to a great extent
but can you run a corrupted file?
im getting this error whenever i try to convert an ui file
to a py file
pls help me with this
im just a beginner
anyone?
Can someone help me please in #help-pancakes
Hey man
pyuic5 -x <ui file goes here> -o <name of your new py file here>
maybe try: pip install pyuic5
I'm not new to Python, but I'm 100% in terms of building GUIs with Python. What is the best GUI framework out there?
I say PyQT5
with QT Designer
you cant pip install pyuic5
try searching for pyuic5.exe, and run the command from there
I would recommend KivyMD for creating GUIs. It uses the Kivy framework but implements Material Design components
@unique forge What are you talking about?
Pyside2/PyQt looks exactly the same as the C++ counterpart
that's because its just a python wrapper for qt
i don't know if this applies here, but the python innteractive shell is also an user interface ...
can i somehow change autocompletition in the python shell, so that it completes also strings to filenames?
do i have to modify the rlcompleter for it?
i know ipython, but i wan to know if i can write some autocompletition for special purposes myself ...
oh, you only asked about auto complete in strings which IPython does. I'm not sure how to go about customizing autocompletion.
hmm maybe my question wasn't clear. I found something called fancycompleter and i look now how its done there
import tkinter as tk
window = tk.Tk()
window.title("GUI")
l1 = tk.Label (window, text="eureka!"))
window.geometry('350x200')
l1.grid (column=0, row=0)
bt = tk.Button (window, text="Enter")
bt.grid (column=1, row=0)
window.mainloop()
whenever i try running this python freezes and says application stopped working
oh wait nvm now it works
as soon as i ask for help here it works
Does anybody know how to make writing effect in Urwid?
@sweet kindle you have an extra closing parenthesis on l1
yeah i know dont worry got it to work
@half yacht What do you mean by writing effect?
Which library is best for creating modern looking interfaces?
I don't like the ways tkinter looks
Pyqt5
pyside2/pyqt
There's ttk, a more advanced (and poorly documented) version of Tkinter which uses native OS elements and a theming system to make GUIs. But there are better options, like PyQT, which comes with PyQT designer which is a drag and drop window creation tool, it will write the code for the window for you, you just have to write the backend stuff
I meant C# and/or JavaScript are better for GUIs
but PyQT is definitely the best one for Python
define better
probably
LG WebOS was Made with QT
and Mercedes Entertainment system
but I dont think that was Python/PyQT
or C++
open a help channel so we don't spam this channel with off-topic chat
can I do it in DMs?
Hey everyone
how do i take combo box as input ? in PySimpleGUI
Using Tkinter hwinfo_height and hwinfo_width both return 1 and so does hwinfo_reqheight and hwinfo_reqwidth. Both self.update() and self.update_idletasks() have no effect when executed before the hwinfo methods.
I think it's because it hasn't maximised the window yet
Henlo c:
How i can clear all widgets in Tkinter?
hello guys I need help with a simple task
How do I put an image as background in a tkinter window
@worn viper what is it about kivy that you prefer?
File "C:\Users\linkm\Desktop\classpro\Reports.py", line 13, in quary
for record in base[0:]:
TypeError: 'sqlite3.Connection' object is not subscriptable
def quary():
base = sqlite3.connect('NewSales.db')
print_records = ""
for record in base[0:]:
print_records += str(base) + "\n"
I am trying to have a button print the database on the gui
@digital rose what GUI library are you using?
ok
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.
Anyone know any good alternatives to PyQtWebEngine
import tkinter.font as tkFont
import sqlite3
Reports = Tk()
def Exit():
Reports.quit()
#loop thru results
def quary():
base = sqlite3.connect('NewSales.db')
print_records = ""
for record in base[0:]:
print_records += str(base) + "\n"
print(print_records)
title = LARGE_FONT = ("Verdana", 15)
ec = medium_font = ("Verdana", 12)
Reports.geometry("420x232")
title = Label(Reports ,text="Reports",height=4, width=60, bg="#333333", font=LARGE_FONT,foreground="white")
title.pack()
cl = Button(Reports, text='Customer list',height = 2, width = 60,bg="grey",font=medium_font,foreground="white").pack()
ps = Button(Reports, text='Sales',height = 2, width = 60,bg="grey",font=medium_font,foreground="white",command=quary).pack()
exit = Button(Reports, text='Exit',height = 1, width = 60,bg="grey",foreground="white",command=Exit).pack()
Reports.mainloop()```
@unique forge
so what do you want to do
I want the data base to be printed under the button when the button is pressed
so like if u press the customer button it will print all the customer names under the button
do you want me to @unique forge when i answer?
I guess i should lol that would make sense, do you mean instead of the print command i put label?
how would i go about printing the data base that way tho?
hi guys, i am trying to get my tkinter label text font size be somewhere around 20 but i can't seem to find a way to do it
oh my god
i finally got opencv to properly display a black and white image on pyqt
the slider controls the max threshold for the grayscaling
Were you having trouble getting the image to display?
@maiden nymph
label.config(font=("Courier", 20))
well the font doesnt rlly matter just choose any
almost an hour of sigsegv, trying out different color formats, and feeding the data into a QImage
idk how it would sigsegv with the choice of, say argb32_Premultiplied as opposed to just argb32
im still sort of novice with python ๐
hi guys how would i make my search bar look up items in my catalogue
butt = Button(fram, text='Search')
butt.pack(side=RIGHT)
fram.pack(side=TOP)
ok, ima try that
label is not defined
i used this ```Label.config(font=("Courier", 20))
then i put Label.config(self, font=("Courier", 20)) and it says NameError: name 'self' is not defined
@keen path
I tried selecting a value in Combobox, but it doesn't work. It just stays blank.
Code (using tkinter):
n = StringVar()
methodEntry = ttk.Combobox(Frame, textvariable=n, state="readonly") #create Combobox
methodEntry["values"] = ( #fill combobox with values
"GET",
"POST",
"PUT",
"GET",
"PATCH",
"DELETE",
)
for x in range(len(methodEntry["values"])): #iterate over fields of combobox
if methodEntry["values"][x] == 'GET': #find entry that has content 'GET'
methodEntry.current(x) # Select the entry
break #stop iterating
methodEntry.grid(row=0, column=0) #place combobox in frame
Screenshot:
guys how do i allow the user to enter a search keyword and display all products that match the keyword?
@snow saffron write a function to search for keywords, pass the input to the function when pressing 'Search' button
can u gimme an example please @swift tide
oh, now i got my font thing to work
Hey guys. Im looking for a light weight gui library that integrates well with matplotlib. Something that is quick to implement. Any suggestions?
Please @ me if you respond. Thank you.
What's a professional colour scheme / theme for ui?
get a color palette from any website
or
use an ide or desktop theme that already exists and build from that
if you're using qt then it will automatically use the system themes from whatever system it's running in, esp. KDE or gnome (really any system that supports gtk themes)
personally I use a modified version of Ayu Dark from teabyii, which is a sublime text and vscode ide
hey anyone using the kivy framework to make user interfaces?
any idea whats the reccomended framework to make mobole apps
Not sure what the use case for python on a mobile apl would be. Why not Java if its Android?
Wanna make cross platoform, i would have to learn both
Hello I want a scraper from txt file my scraper read only one lines but one data required other I want read both of them but I dont know how I can make this ? (Data can change anytime)
Anyone with PyQT5/Pyside2 experience? I'm having trouble fixing something:
On software, for example, discord, when you maximize the window, if you go to the title bar with your cursor and try to move the window, the window would unmaximize and you would be able to move it as it was before with the cursor locked onto the same place it gripped on in the first place.
I have done this with my program, however, when you try to move the maximized window, it unmaximizes like how it was before. The grip is still there so you can still move the window but the cursor is not gripped onto the window as it is moving.
How would I solve this problem?
I'm happy to screenshare to show the problem ๐
hello guys can someone help me please?
Sure
um so I have a code and I kinda got lost doing it I'm a beginner
I'm trying to make a login system using tkinter for GUI
um I just generally got lost writing the code and I was wondering if you wouldn't mind checking it please?
if that's possible?
@glass dagger do you have a video of what you're talking about?
from PyQt5.QtWidgets import QApplication, QLabel
app = QApplication([])
label = QLabel('Hi Everyone!')
label.show()
app.exec_()
I can show you on screenshare quickly if you want
You can mute mic
oh, I don't have a mic hooked up anyway
I didn't realize you hade created a custom title bar.
I can help with the stackoverflow question though
Can you post your code for the title bar?
@glass dagger
Its a .ui file into a .py
With pyside2
I can screen share and show you the the problem
hi guys, quick question. so i am using tkinter to display some labels and i have these 2 DateTime_label.grid(padx=300, pady=450) weather_label.grid(padx=450, pady=300) when i run the program only the first one "DateTime_label" is displayed. why is that?
!e print(450+10+450+300)
You are not allowed to use that command here. Please use the #bot-commands channel instead.
hmm
okay so 1210 pixels before the second widget is allowed on the screen assuming a height of 10 pixels for the widget
do you have a 1080p monitor?
Is there a point this video?
<@&267629731250176001> this video is being spammed in different channels
!pban 778272866663530496 Video spam.
:incoming_envelope: :ok_hand: applied ban to @valid plank permanently.
Hi, I have a lot of problems with installing kivy, I solved some of them but now I don't know what to do, does anyone know what's going on and how to fix it?
There is link to pastebin with error content https://pastebin.com/UhXy3XKt. This error occurred while installing the kivy with command
python -m pip install kivy == 1.11.1
pip install kivy[base] --pre you shouldnt be using 1.11.1 with py3.8
ok thanks it works
hi, i'm try to make os with python and my gui is bad or good ? (send a advice pls)
making os using python?
yep
i trying
but its so hard
:c
from tkinter import *
import requests
from datetime import datetime
import sys
api_address = "http://api.openweathermap.org/data/2.5/weather?q=Tucson&appid={My API Key}"
root = Tk()
root.geometry("{0}x{1}+0+0".format(root.winfo_screenwidth(), root.winfo_screenheight()))
json_data = requests.get(api_address).json()
formated_weather_data = "Main: " + json_data["weather"][0]["main"] + "\n" + "Description: " + json_data["weather"][0]["description"]
weather = json_data["main"]["temp"]
weather_in_farenhite = round((weather * 9/5) - 459.67)
formated_temp_data = "Temp: " + str(weather_in_farenhite) + "ยฐF"
formated_pressure_data = "Pressure: " + str(json_data["main"]["pressure"]) + "inHg"
formated_humidity_data = "Humidity: " + str(json_data["main"]["humidity"])
formated_windSpeed_data = "Wind Speed: " + str(json_data["wind"]["speed"])
formated_Sunrise_data = "Sunrise: " + str(datetime.fromtimestamp(json_data["sys"]["sunrise"]))
formated_Sunset_data = "Sunset: " + str(datetime.fromtimestamp(json_data["sys"]["sunset"]))
DateTime = str(datetime.now())[:19]
weather_label = Label(root, text=formated_weather_data, font="times 24 italic")
Temp_label = Label(root, text=formated_temp_data, font="times 24 italic")
pressure_label = Label(root, text=formated_pressure_data, font="times 24 italic")
humidity_label = Label(root, text=formated_humidity_data, font="times 24 italic")
windSpeed_label = Label(root, text=formated_windSpeed_data, font="times 24 italic")
Sunrise_label = Label(root, text=formated_Sunrise_data, font="times 24 italic")
Sunset_label = Label(root, text=formated_Sunset_data, font="times 24 italic")
DateTime_label = Label(root, text=DateTime, font="times 24 italic")
DateTime_label.grid(ipadx=500, ipady=350)
weather_label.grid(ipadx=450, ipady=300)
root.mainloop()```
i am trying to make some sort of window to collect weather data and then put it on the screen.
oh, got it to work
looks like it was a weird coordinates thing. also, how can i find the coordinates of the place i want to put the label? i know i worded my sentence wrong
i dont understand @maiden nymph
understand what
oh
this also, how can i find the coordinates of the place i want to put the label?
so, i want to place these labels in different coordinates on the window but, i do not know where each coordinate is. is there an easy way to know where each coordinate is?
@maiden nymph you should write code like this:
```python
<Your code here>
```
It enables syntax highlighting, so it's a bit more readable
got it
Hello how can i build a gui application on python
Use Pyqt5 @fiery river
There are also other libraries such as Kivy and Tkinter
But pyqt is the best imo
PySide2 == PyQt5, so go with either of those
If you do choose PySide2 and you don't know how to do something, you can always use PyQt5 in your google search and most code you copy will work without modifying anything but the import statements
hi, im trying to make a part of my program throw an error message when anything other than lower case letters are entered into a text box but im having difficulties, any ideas?
try:
# get the selected button. Use getSelectedButton()["value"]
sel= self.group.getSelectedButton()["value"]
# get the data entered in textField. Use getText () method
MSG = self.textField.getText()
# if selection is "encode" = use encode_text () method, otherwise
if(sel == "Encode"):
newtext = (encode_text(MSG))
# "decode_text () to obtain encrypted or decrypted text
else:
newtext = (decode_text(MSG))
# display the text in output field using setText() method
self.output.setText(newtext)
self.Invalid.delete(0,END)
except:
self.Invalid = self.addTextField("Invalid Text", row=1, column = 2)
if(MSG.isupper() != MSG):
messagebox.showerror('Error','Error: Text must be lower case')
elif(MSG.isspace() != MSG):
messagebox.showerror('Error','Error: text must not contain spaces')
elif (MSG.isdigit() != MSG):
messagebox.showerror('Error','Error: text cannot contain numbers')
Do you really need to have an error for this?
@molten basalt
I think forcing the text to lower case would be easier and less problematic
because its part of the project parameters
Okay, then just use if/else
there isn't an exception that covers a text case
and it appears you just need to show the message box, is that right?
not actually raise a python error or catch something in try/except?
so im building a UI and integrating another loop that updates the UI. Im working with tkinter on this one
my problem is integrating the 2 loops together. I understand threading and things like that, is there any
resource i can use to understand how to thread in tkinter
Usually the rule with threads inside a GUI is to use them however you normally would but don't update any elements in the GUI from the threads.
Sorry it just really felt like it when he gave me a brain that can't function properly
I don't know how to put rows and columns on buttons in tkinter
And when he gave both my grandfathers cancer but that is for another time
what do you mean you don't know what to do with the rows and columns?
What have you tried and what happened ?
row 0 col 0 would be the top left of your window/container I'd imagine
you don't need pack
I wrote this up once, the general idea is having a self-calling .after routine which repeatedly checks a queue the thread writes into: https://gist.github.com/Square789/46b0fdf0905c229567798ff9f3ebc275
The queue contains tuples where the first element is an enum-ish signal constant and the next elements can be pretty much whatever information you want to pass between thread and UI.
It gets more complex though if you want to i. e. stop a running thread or ensure a safe and quick shutdown of your app with running threads, just ping me if you have more questions regarding that
that makes perfect sense thanks @amber roost
my except: always launches for some reason at the start of my code, how do i prevent this?
try:
# get the selected button. Use getSelectedButton()["value"]
sel= self.group.getSelectedButton()["value"]
# get the data entered in textField. Use getText () method
MSG = self.textField.getText()
# if selection is "encode" = use encode_text () method, otherwise
if(sel == "Encode"):
newtext = (encode_text(MSG))
# "decode_text () to obtain encrypted or decrypted text
else:
newtext = (decode_text(MSG))
# display the text in output field using setText() method
self.output.setText(newtext)
self.Invalid.delete(0,END)
except:
self.Invalid = self.addTextField("Invalid Text", row=1, column = 2)
if(MSG.isupper() != MSG):
messagebox.showerror('Error','Error: Text must be lower case')
sorry chris for not coming back earlier, my dad needed my help before you responded so I had to go AFK
@eager beacon
I don't know
are you trying to encode a non existant MSG, or is it that delete?
If you just need to show a message box I don't see a reason for using try/except since you there are no exceptions for when the case doesn't match what you say it should be.
you'd have to define you're own exception for that
@keen path is it okay to tag you? are you good with syntax highlighting
wdym by syntax highlighting
are u making a text editor
oh i thought u were talking about tkinter
i dont know how to properly use pygments, i tried to read the docs, i understand it, but cant really apply it on syntax highlighting
and how would i do that with yaml?
so i want some help
@peak turret
yep
shi
i deleted that code
well i made a program in tkinter that
it's basically a drawer
like MS Paint
ye
I do not think so
k
@keen path outline =1
? @peak turret
lol my file has 300+ lines of code
oh ok
How do I add an image inside a class for a gui
can someone give me some help with pyinstaller. I want to package a folder with my GUI and id rather not specify each subfolder and file inside it in my .spec file
is there a way i can write a single like of code to the .spec file so that it bundles the folder and all of its contents
a.datas += Tree('./dir_to_include', prefix='dir_to_include') something like this maybe found on stack exchange but not available to test it right now
Should I use Tkinter or Guizero for making UI's in Python?
r = PhotoImage(file = 'images/register_btn.png')
Button(root1, image = r, command = register_user, borderwidth = 0, highlightthickness=0, bg = '#f59042', activebackground = '#f59042').pack()
```Why does this not show the button? No errors
oh
man
has
anyone
some
tutorial
for
the
user
interface
but
in
a
website
?
oh
I think you should use PyQT5
what do you want to use to create a UI @median vector
which module
i want to create a login
website
I use pygame for the user interface
ok
For a app
pygame is fine, but it isn't meant for user interface
it's meant for games
It s for games
use #web-development
yes, not UI's
Ok
oky thank u
btw use Django
and you might want to know HTML
@median vector or you can use something like https://wix.com or https://wordpress.org
i know, but i don't like wix
why don't you like wix?
because its free and its unproffesionell
then use wordpress
wordpress is a professional builder
yea, but i need it for my project
ok, does it have to be programmed?
nope, i only need the login form
nope
then django is best
but does it have to be functional
oky thx
both
okay, what is the next step?
okay
you know the python basics, right?
i hope xD
yes xD
ah okay
Frontend is HTML, CSS, JavaScript
Backend is Python
im sure you can google up a login template with HTML
I'm trying to make a simple 2048 game. What's the best way to do this with a ui? It would be cool to have animations similar to the original and be able to put it in a website(though I have no idea how that works)
@lone zodiac #game-development may suit you better
ok_btn = PhotoImage(file = 'images/ok_btn.png')
Button(root4, image = ok_btn, command = delete4).pack()
```help what is wrong with this?
how about packing the button below
separately
like a = Button()
and a.pack()
same thing
exit_btn = PhotoImage(file = 'images/exit_btn.png')
Button(command = exit_main, image = exit_btn, borderwidth = 0, highlightthickness=0, bg = '#f59042', activebackground = '#f59042').pack()
```This works
oh ok
@modern marsh root4 = Toplevel(root)
uhh
but that should not make any diff
why do you do import * lol, it confuses me
the 1st one look so nice I want it like that ๐ฆ
this might not be a good idea
but how about you make a new frame
and put the button there
I will have to do too much work
so I make new frame and then place the button there?
ye
@modern marsh frame also didn't work
what langauge you speak
english you?
mhmmm i cant tho lol
ok
ok
so you've already implemented the scroll bar function you just don't have it in the right position?
yeah is it working for you ?
it allows me to scroll
can you show me UI as screenshot
but there isn't a visible scroll bar
oh i see
that was my old code when i used to add that code in frameR class
oh ok
can u send ur new code?
repl is nice i like it
๐
but i never realised that it even have a UI window ๐ฎ
lol
bruh I am so mad rn
nice rectangle
cant you just manually set the pos for the scroll bar
images on button won't work