#user-interfaces
1 messages · Page 88 of 1
I'm giving PyQT5 a shot as my first GUI, it'll be relatively simple. Where could I find some decent tutorials on it?
I am still a beginner at python but I know the basics, if I wanted to learn how to make proper UI's where should I start?
@autumn scaffold you can refer to this!
I install pyquaternion in cmd promp but when i code something and run it it tells me ModuleNotFoundError: No module named 'pyquaternion'
do yall know why?
can anyone explain to me on the```py
dash=(200,250)
import tkinter as tk
main_win = tk.Tk()
shapes = tk.Canvas(main_win, width=500, height=500)
shapes.pack()
shapes.create_rectangle(130,25, 360,100, fill="#ff1400")
shapes.create_rectangle(130+10,25+10, 235,90, fill="blue")
shapes.create_rectangle(255,25+10, 350,90, fill="blue")
shapes.create_rectangle(10,100, 10+480,175, fill="#ff1400") #big rectangle
shapes.create_oval(100,150,100+50,150+50, fill="black")
shapes.create_oval(340,150,340+50,150+50, fill="black")
shapes.create_oval(120,170,120+10,170+10, fill="#a0a0a0")
shapes.create_oval(360,170,360+10,170+10, fill="#a0a0a0")
shapes.create_arc(450,150,500,200, style="pieslice", fill="#a0a0a0")
shapes.create_line(11,125, 490, 125, dash=(200,250),fill="white", width = 3)
import tkinter.colorchooser
def getColor():
color = tkinter.colorchooser.askcolor()
print(color)
tk.Button(text="Select Color", command=getColor).pack()
main_win.mainloop()
i saw this website just now
im confused as idk what is the difference between 4 pixel and 2 pixel
cuz they look the same to me
after i run my code
if i put dash at value 100,100
and 200,250 is the same
almost the same i guess
so im abit confused atm
Try (1, 10)
is BeeWare complete?
What would be the best import module
for using HTML as my interface
I tried seleniun
selenium*
and Flask
and EEL
but so far none of them are working too well
is there a way to make my own web driver
and use that as a way
to like... run my interface
Maybe you could try CEF python (https://github.com/cztomczak/cefpython)
Selenium and Flask are entirely two different types of software
it would be better if you describe better what u a trying to achieve
Hi
I made a music player with dancing raccoons. A longer video and project details can be found here.
https://www.reddit.com/r/Python/comments/sp7ddv/my_first_project_raccoon_music_player_cute/
Nice. Quite frontendish.
lol, what do you mean by frontendish?
🤔
Most of the code for this stuff is purely frontend logic/code (Basically your project is made out of 100% frontend, if you did not add anything else to it)
So, nice style for frontend stuff
Oh, you made it as desktop app, funny, I just did not look at the code. I just in my mind quickly rematched it to Frontend capabilities 😉 (Your project can be theoretically remade with frontend framework, CSS / Javascript stuff as a web app)
That's why named it so
Yeah, it probably could be made with Javascript, React native, etc., but the point is that it isn't 🙂
A bit too much thinking within web dev department
Web stuff rulezz, cross platform availability without installing anything ;b
lol, how would you do that with Python though. Electron is a very heavy framework for this. CEF maybe?
No, I mean as a web site
So React / Vue.js / Angular stuff
Python would be participating at best only to have more sophisticated music storage
I definitely see the benefits of web and just going by the numbers that 's where development is focused and has been heading for a long time. In case of a web app, you would probably link it to the Spotify API as well. Why use local files when you are on the web?
But would you play your games on the web? Where would you draw the line? In this case, I like that the app unfurls and you can drag the app around. It provides a tactile experience to the player that web doesn't, not for me anyway.
Anyway, I take it as a compliment that you would see this as a frontendish web application!
dancing racoons - nice idea
i want to use Tkinter to talk to a existing CLI program for SDR ( sofware defined radio ) to control its functions -- is that a frontend ?
Thanks!
Is that question about Tkinter or Dear PyGui?
Dear PyGui is a GUI framework for Python, just like Tkinter, but more modern and faster with plotting, node editor and graphical functionality built in. I guess you’d call it a front end for a desktop application, not web.
https://github.com/hoffstadt/DearPyGui
Here are some apps made with Dear PyGui to give you an idea what can be done with it.
https://github.com/hoffstadt/DearPyGui/wiki/Dear-PyGui-Showcase
Best way of Python GUI tool for beginners?
I heard that Tkinter is the ideal, but I wonder if there are alternatives too
Check out the "guizero" package -- it's pretty easy to learn and has good documentation. It's basically a wrapper around tkinter. It's really great for simple and quick GUIs.
no. frontend is what you see on your screen, so all the visual elements that are part of an interface, for instance Buttons, Scrollbars, Text widgets and so on, are all part of frontend. if you plan to send / receive a stream of data to / from an application or a process, that's back-end, i.e the nervous system of a program.
@digital rose you can refer to this giant essay i wrote.
any simple tkinter app on github? i want to look at how ppl develop using tkinter before actually making my own programs
Very nice app. Looks great. I wish I had used pygui for a project I'm working on. Tkinter has no built in functions for adding custom fonts and its a headache. I saw you called dearpygui.add_font() to add fonts to registry, I'm going to try doing that, maybe it'll work lol?
Thank you! Am I understanding you correctly that you want to use Dear PyGUi to add fonts to the registry of Tkinter? If so, I highly doubt that it would work. Doesn't Tkinter have theming for TTK or something? I never used Tkinter, but I see that mentioned sometimes.
You can always use Dear PyGui on your next project. Here are some other apps made with Dear PyGui.
https://github.com/hoffstadt/DearPyGui/wiki/Dear-PyGui-Showcase
There is a discord server for Dear PyGui as well in case you need help. By the way, it's called Dear PyGui. There is another, much older framework called PyGui, which is why the distinction is not trivial.
What are you working on?
Yea, if that add_font() function adds it to the windows registry, then there is a slight chance it might work. But if its a pygui specific registry thing then yea, it probably won't work. I will look into it. And yea it has theming but there is no support for custom fonts as far as I know.
I'll definitely use dear pygui next time, thanks for the info! And the app is a GUI for a music splitting program.
Cool! Sounds like it is shares some features with this application (built with an older version of Dear PyGui, it won't run out of the box with the latest version of Dear PyGui). @stiff geyser
thank you^ will check that out
it's not really necessary to force a font install. if you use a python-to-exe packager (like pyinstaller), you'll notice that the font gets packaged along with your code. so, you won't need to enforce an install in that particular case.
ponder - ponder - ponder - have a drink - ponder ponder
Yea I know, the issue was not packaging the font with the code, but for tkinter to access the font, it has to be temporarily added to windows.
But I figured it out. These lines do the job
gdi32 = ctypes.WinDLL('gdi32')
gdi32.AddFontResourceW("Mercy.ttf")
AddFontResourceW() temporarily "installs" a font in Windows.
and tkinter can then use that font
it doesn't really matter either way. you could package this:
import tkinter as tk
from tkinter import font
root = tk.Tk()
uifont = font.Font(family="DejaVu Sans Mono", size=16);
text = tk.Text(root, font=uifont)
text.pack(side="top", fill="both", expand=1)
root.mainloop()
and it would work (atleast when packaging with pyinstaller).
and since you've initialized the font publicly, it would work. why'd tkinter not recognize / access this font?
but anyways, you've solved it, and that's that i guess.
Oh, so If I package that code with pyinstaller and the font file, it would just work like that?
If thats the case, I'd rather do it that way.
no, you wouldn't need to package the font file along with it. it just needs to be installed on your system, and pyinstaller will create a portable version of that font file, i believe.
Okay, will try that out. Thanks for the info.
how to close tkinter window and create a new one with clicking a button?
which ui library did you used? it looks modern and beautiful
hard to believe this thing is built on python ui libraries
"Made with Dear PyGui and PyMiniAudio" - Just follow the link in the post. The project is well described there.
I appreciate your compliments! The GUI framework is Dear PyGui. It’s the only library used for the front end. The list box, scrollbar and buttons are Dear PyGui style (they are themeable with regard to colour and rounding). You can load any font you want, so I used four different fonts. All other elements are images. Dear PyGui is written in C/C++ (and uses the GPU for rendering, which makes it quite performant) with Python bindings.
Does anybody use Qt here? I'm trying to get QWidget's real screen size. Is it possible?
I've tried:
self.size()
self.geometry.size()
self.frameGeometry.size()
self.frameSize()
None of these return real size.
Is there a font out there that includes color emojis that is compatible with tkinter?
w1 = window_you_want_to_close
def manage_windows():
w1.destroy()
w2 = tk.Tk()
Did you mean something like this?
You can also use this to remove all widgets and start over
root = Tk()
def fresh_window(root):
for i in root.winfo_children():
i.destroy()
fresh_window(root)
I was making a program and was using the Label class, but it appears that when i display it to screen, the image is comepletely blank. Could it be an anchoring problem?
I have a very long code so i will just add the important things here
titleScreen = Frame(window, width=width, height=height)
titleScreenIMG = PhotoImage(file="Assets/TitleScreen.png")
titleLabel = Label(titleScreen, image=titleScreenIMG)
titleLabel.pack()
titleScreen.pack()```
there seems to be no error with the image path either
Tkinter requires you to save a reference to the image somewhere. The easiest way to do it in your case is titleLabel.image = titleScreenIMG
And I think that should work
I saw people talking about keeping a reference. i couldnt really understand that
btw in tkinter, does the layer of objects work as per the line where it was created or the line where it was placed
Placed/packed/gridded
But the ID of the object is generated by the order of creation
that seems to work but the placement and size seems messed up
Try packing the label with the options expand=True, fit="both"
Maybe just with expand=True and make sure the size of the image matches the size of the frame
actually
i had a canvas doing the .create_image() function
that i forgot to mention in the above code
and i commented it and it stopped displaying
but it worked only after i created a reference, as u told me to
Labels have the capability to display images by themselves, no need to use a canvas, yeah
would u like to join a vc where i can screenshare my code?
because atm, its very messy to show someone
Okay
Yeah screen sharing is not possible here anyway
I did this but the intvar variables I set for the checkbuttons to keep them inactive by default don't work!
Sry for my bad english
hi hi uhhh
i need help with PySimpleGUI
i regret even looking at this package but now i have to finish what i started
i need help plz ping me if someone knows it well
anyways no one wants to ping me
so im having some problem with the program im making, its technically a 10 question math thingy that it randomly asks 10 questions that are adding and then after those it gives you your score and the time you answered it
and im having problem with getting the answer and like almost everything
im so lost in the way pysimplegui works idk what to do
ik how to get an answer but idk how to put them in a table or data base then show it in another place
currently my code is working how it is coded but not the way i want it to
Is there any way to move a shapes point,
Like i have a line in canvas and i want to move just the one end of point
Is that possible?
im pretty sure i saw a tutorial about moving labels with cursor
you could delete and re-draw the line, with the 2nd set of coordinates (i.e, the end-coords, where you moved the end point of the line segment).
this is where canvas objects come into play. you can name the line based off of a specific tag / id, and use that to delete the line. for instance,
canvas.create_line(10, 10, 100, 100, tags = "line")
now if you'd call canvas.delete("line"), that particular line will not be rendered anymore.
👍
Im just one thing needed that i want to get the canvas item in that points sure there is
😅working on simulation using tkinyer canvas
so you wish to figure out what canvas object lies on a particular point?
Yes
i think the canvas.find_closest(m, n) works just fine, since it will return the id of the object nearest to the position (m, n).
hey um do anyone know how to work with pysimplegui?
im trying to make it so it will give me another random number every time i press the enter button but idk how to do it
plz help me i need it quick
What do you mean by 'real' screen size?
If you're trying to get the size of the widget before its visible, it won't work.
.size() should give you the correct size excluding the window
Yeah. I figured out I was trying to use .size() right before the widget was shown. Thx.
hey, im trying to make the bg of my tkinter window a gif
org = Tk()
org.configure(bg = 'black')
org.title('X.M.')
org.geometry("569x800")
frameCnt = 44
frames = [PhotoImage(file='love-stars.gif',format = f'gif -index {i}') for i in range(frameCnt)]
def update(ind):
frame = frames[ind]
ind += 1
if ind == frameCnt:
ind = 0
label.configure(image=frame)
org.after(100, update, ind)
b1 = PhotoImage(file='button1.png')
button_1 = Button(org,image=b1,bg='black',command = months, text = 'VIEW MONTHS')
#button_1.config(font = ('Porter',19,'bold'), height = 2, width = 15,relief = GROOVE)
button_1.config(relief=FLAT)
button_1.place(x = 250,y = 100)
button_2 = Button(org,command = add_data, text = 'ADD DATA')
button_2.config(font = ('Porter',19,'bold'), height = 2, width = 15,relief = GROOVE)
button_2.place(x = 250,y = 300)
button_3 = Button(org,command = get_advice, text = 'GET ADVICE')
button_3.config(font = ('Porter',19,'bold'), height = 2, width = 15,relief = GROOVE)
button_3.place(x = 250,y = 500)
label = Label(org)
label.pack()
org.after(0, update, 0)
org.mainloop()
but the label hides the buttons
how do i make the buttons come on top
yeah that can be confusing. Glad you got it working 👍
Maybe try placing the buttons after you have packed the label. That way, the code would render the label first and then the buttons which should make them come in front of the label.
i take that back, prolly i messed up last time, but it works now
u r a lifesaver
Happy to help
I found that u dont need to delete the object and draw again and again, just like we use canvas.coords(shape) to get the coords if we do canvas.coords(shape, x0, y0, x1,y1) it will set the shaoe to these locations and hence modfying the shape
It just gives weired effects on some cases like when on among x1 y1 is less than x0 y0 respectively
Test this code, this acts as draw circles program
I think i need to move the circle if it dont works proper on that problem
hello, so I am making a random name generator, which should get a random name from a list, remove that name, then, when the button on the GUI is clicked, pick a new name that isnt in that list, until there is only 1 name left. i am kinda unsure of what to do rn tho because it can pick a random name and remove that name, but how do i make it so that it will pick another name that is in the list continually? here is the code:
from tkinter import *
import random
names = ["MESSI Lionel","RONALDO Cristiano","TRUMP Donald","BIDEN Joe","JOHNSON Boris"]
random_name = random.choice(names)
def new_name():
window.destroy()
names.remove(random_name)
window = Tk()
window.resizable(False,False)
name_gen = Button(window,text=random_name,
font=("Arial",40,"bold"),
fg="#3419e3",
activeforeground="#3419e3",
compound = "center",
command=new_name)
name_gen.pack()
icon = PhotoImage(file="C:/Users/thoma/Desktop/Screenshot 2022-02-13 133639.png")
window.iconphoto(True,icon)
window.title("Random Name Generator")
window.geometry("500x100")
window = mainloop()
What's the simplest way to have a url link of a gif display in PyQt?
I could see that but I'm making a Pokedex where users can search Pokemon. I doubt they'll want the dozens if not more pictures of Pokemon sitting in their computer folder, unless the downloaded images are temporary.
I don't understand why you would save them. Just use the raw data
"Raw data"? Sorry I'm a bit confused.
I might be too...
How do you plan to download the movie?
I assumed you were going to use an http request?
Here's an example
import requests
from PyQt5 import QtNetwork
from PyQt5.QtCore import QUrl
from PyQt5.QtGui import QMovie
from PyQt5.QtWidgets import QApplication, QLabel
url = 'https://i0.wp.com/www.printmag.com/wp-content/uploads/2021/02/4cbe8d_f1ed2800a49649848102c68fc5a66e53mv2.gif?fit=476%2C280&ssl=1'
if __name__ == '__main__':
app = QApplication([])
label = QLabel()
movie = QMovie()
movie.setCacheMode(QMovie.CacheAll)
label.setFixedSize(400, 200)
label.setMovie(movie)
# setup up the http request
request = QtNetwork.QNetworkRequest()
request.setUrl(QUrl(url))
manager = QtNetwork.QNetworkAccessManager()
# if the request was successful the reply will contain the image data
reply = manager.get(request)
# since QNetworkReply is a QIODevice we can use movie.setDevice
movie.setDevice(reply)
reply.finished.connect(movie.start)
label.show()
app.exec()
you can use requests instead of the QNetwork stuff
If you do, use a QByteArray and a QDataStream as the device
You need not destroy the window each time you get a new name. Just make a function that would get a random value, remove it from the list and display it. Bind that function as the command for a button and you will be good to go.
Thanks for this. Your code works. However, when I try to apply it and tweak it into my own it doesn't.
I get this traceback:
Traceback (most recent call last):
File "c:\Users\nomar\Dropbox\Code\SecondScratchPad.py", line 93, in <module>
ex = MainWindow()
File "c:\Users\nomar\Dropbox\Code\SecondScratchPad.py", line 44, in __init__
self.mw_attributes()
File "c:\Users\nomar\Dropbox\Code\SecondScratchPad.py", line 55, in mw_attributes
self.movie.setCacheMode(QMovie.CacheAll)
AttributeError: type object 'QMovie' has no attribute 'CacheAll'
This is my full code:
https://paste.pythondiscord.com/ekecokefoj.rb
Snippet:
class MainWindow(QWidget):
def __init__ (self):
super().__init__()
self.title = "Pokédex"
self.left = 200
self.top = 300
self.width = 520
self.height = 924
self.mw_attributes()
self.start_button()
self.show()
def mw_attributes(self):
self.setWindowTitle(self.title)
self.setGeometry(self.left, self.top,self.width, self.height)
self.setFixedSize(self.size())
self.pokemon_gif_screen = QLabel("Label", self)
self.movie = QMovie()
self.movie.setCacheMode(QMovie.CacheAll)
self.pokemon_gif_screen.setGeometry(170, 380, 472, 460)
self.pokemon_gif_screen.setMovie(self.movie)
request = QtNetwork.QNetworkRequest()
request.setUrl(QUrl(url))
manager = QtNetwork.QNetworkAccessManager()
reply = manager.get(request)
self.movie.setDevice(reply)
reply.finished.connect(self.movie.start)
```
PyQt6 changed the enums, so its QMovie.CacheMode.CacheAll
Thanks.
Ran it again and got this:
Traceback (most recent call last):
File "c:\Users\nomar\Dropbox\Code\SecondScratchPad.py", line 93, in <module>
ex = MainWindow()
File "c:\Users\nomar\Dropbox\Code\SecondScratchPad.py", line 44, in __init__
self.mw_attributes()
File "c:\Users\nomar\Dropbox\Code\SecondScratchPad.py", line 59, in mw_attributes
request.setUrl(QUrl(url))
TypeError: setUrl(self, QUrl): argument 1 has unexpected type 'QUrl'
I assume QUrl also chaanged?
No
An error like that usually means you have 2 different bindings imported
double check your imports
Okay, I changed my imports to this:
#GUI
from PyQt6 import QtNetwork
from PyQt6.QtGui import*
from PyQt6 import QtWidgets
from PyQt6.QtWidgets import*
from PyQt6.QtCore import QUrl
App runs
but I don't see the gif 😦
My code seems fine to me:
url = 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-v/black-white/animated/shiny/6.gif'
class MainWindow(QWidget):
def __init__ (self):
super().__init__()
self.title = "Pokédex"
self.left = 200
self.top = 300
self.width = 520
self.height = 924
self.mw_attributes()
self.start_button()
self.show()
def mw_attributes(self):
self.setWindowTitle(self.title)
self.setGeometry(self.left, self.top,self.width, self.height)
self.setFixedSize(self.size())
self.pokemon_gif_screen = QLabel("Label", self)
self.movie = QMovie()
self.movie.setCacheMode(QMovie.CacheMode.CacheAll)
self.pokemon_gif_screen.setGeometry(170, 380, 472, 460)
self.pokemon_gif_screen.setMovie(self.movie)
request = QtNetwork.QNetworkRequest()
request.setUrl(QUrl(url))
manager = QtNetwork.QNetworkAccessManager()
reply = manager.get(request)
self.movie.setDevice(reply)
reply.finished.connect(self.movie.start) ```
You didn't use label.setMovie
the label is like the screen, you're going to need one of those
self.pokemon_gif_screen.setMovie(self.movie)
self.pokemon_gif_screen = label
Does your widget have a layout set, and is the label in the layout?
Full Code: https://paste.pythondiscord.com/iwizojibuj.rb
The only widget is MainWindow and it's in mw_attributes.
The label had no problem putting the gif in when it wasn't a url.
If I had to guess I'd say your manager/request get garbage collected before the request is complete
"Garbage collected"?
When a method finishes any local variables defined inside can be garbage collected(deleted) unless they are returned
A solution could be to define the manager /request in the __init__ or create a list in __init__ and append the manager/request/reply
@coarse mirage This works for me
import sys
# GUI
from PyQt6 import QtNetwork, QtWidgets
from PyQt6.QtCore import QUrl
from PyQt6.QtGui import *
from PyQt6.QtWidgets import *
url = 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/versions/generation-v/black-white/animated/shiny/6.gif'
class MainWindow(QWidget):
def __init__(self):
super().__init__()
self.title = "Pokédex"
self.setWindowTitle(self.title)
self.movie = QMovie()
self.movie.setCacheMode(QMovie.CacheMode.CacheAll)
self.pokemon_gif_screen = QLabel()
self.pokemon_gif_screen.setMovie(self.movie)
self.pokemon_gif_screen.setStyleSheet('background:black;')
self.button_s = QtWidgets.QPushButton()
self.button_s.clicked.connect(self.startRequest)
self.manager = QtNetwork.QNetworkAccessManager()
self._layout = QGridLayout()
self._layout.addWidget(self.button_s)
self._layout.addWidget(self.pokemon_gif_screen)
self.setLayout(self._layout)
def startRequest(self):
self.movie.stop()
self.request = self.getRequest()
self.request.setUrl(QUrl(url))
reply = self.manager.get(self.request)
reply.finished.connect(self.movie.start)
self.movie.setDevice(reply)
self.manager.setTransferTimeout(10)
def getRequest(self):
return QtNetwork.QNetworkRequest()
if __name__ == '__main__':
app = QApplication(sys.argv)
ex = MainWindow()
ex.show()
sys.exit(app.exec())
You should probably read the docs on the QNetwork stuff. I'm not all that familiar with it, so if you get stuck on something, you might be on your own to figure it out.
@eager beacon Thanks it works. Gotta apply it to my current code. I booked marked your link. 🙂
Yeah I have fixed it now, thanks :D
Hi everyone, just looking for recommendations for a framework, library, etc that's offline, to make a dashboard. I wanted to make a dashboard for weather, network health, etc of my home LAN , run it on a Raspberry Pi and display it on a currently unused monitor.
If you want it to be simple and functional then go with tkinter.
That’s exactly what I’m going for thank you
Anyone have good tutorials on getting started with Qt programming for Python? I keep meaning to get into it but it always feels so daunting
I know their the Qt designer/creator app but even then I have no idea how to get started with it, or how to integrate it into existing projects
Cause right now I've been using the gooey library, which basically convert your argparse code into a GUI that you can customize, but it's very barebones
Learn how to create professional user-interfaces for your Python apps.
Lots of good tutorials
I am having a sort of mental hiccup / barrier, something’s not clicking for me. If it’s initialized without arguments, why does the example have arguments?
https://github.com/kivy/kivy/tree/master/examples/demo/kivycatalog
not sure many refer to it though
Not really an alternative as kivy is the only multi-platform one I know but KivyMD is a option you might be aware of.
those are just defaults to arguments, you can put those arguments in and itd override the defaults but you dont have to
^
if you look at those args, they are pre-defined. if you might've studied functions before, you don't need to pass in a value for an argument, if it's already defined, in that case, it uses the value it was initialized with.
for instance,
def func(var = True):
print(var)
if you just call func without passing in a value for var, it would work. it's entirely optional to pass in a value in that case.
func() # works, prints True
# the following work too
func(False)
func("alabaster")
Okay, I'm with you on the default arguments, but the documentation doesn't seem to go into any detail about what any of those default args actually mean, do, represent. If they're default and I could pass in something else, what would that do?
That's my hangup
no idea why the documentation is missing that piece of info, it seems like they started on it, but didn't finish it all the way. however, you can definitely do:
import tkinter
help(tkinter.Tk)
which yields a big chunk of text explaining what the __init__ args do, specifically:
__init__(self, screenName=None, baseName=None, className='Tk', useTk=True, sync=False, use=None)
| Return a new Toplevel widget on screen SCREENNAME. A new Tcl interpreter will
| be created. BASENAME will be used for the identification of the profile file (see
| readprofile).
| It is constructed from sys.argv[0] without extensions if None is given. CLASSNAME
| is the name of the widget class.
it seems like these args are quite trivial for an application.
(that does miss out on useTk , sync and use, no idea why.)
I have to say, nothing makes me feel quite as braindead as programming.
The literature is dense and I'm never sure what questions I'm trying to ask, but thank you, that helps
anytime, fasho.
can i make a ui like this
Which way looks better?
Version 1:
Version 2:
Version 3:
the difference is in the settings button located differently
Can i run kivy app from macbook to iOS without Xcode?
First or third
After some thinking I came up I think with the ideal version. Thanks.
The button surely missed the description 😉
whats the best version of pyside to use?
Ye this is very nice
Guys what difference qt designer - qt creator what should i use
v1
actually yea that v4 is the best
sorry i know Tkinter only 👍🏼
???
please give us more information
cool
someone who know how to resize item in a HBoxLayout in ptqy5?
what's that pretty theme
Usually you place the frame initialization in the OnInit
oh thanks
also, i'm having lots of trouble making a custom button widget. I would like to create a button in the tkinter style, but tkinter is so simple it just doesnt fit my needs rn
this is what i have so far:
import wx
class Button(wx.Control):
def __init__(self, parent, id, label, size, **kwargs):
super().__init__(parent, id, **kwargs)
self.SetLabel(label)
self.SetInitialSize(size)
self.Bind(wx.EVT_LEFT_DOWN, self._onMouseDown)
self.Bind(wx.EVT_LEFT_UP, self._onMouseUp)
self.Bind(wx.EVT_LEAVE_WINDOW, self._onMouseLeave)
self.Bind(wx.EVT_ENTER_WINDOW, self._onMouseEnter)
self.Bind(wx.EVT_ERASE_BACKGROUND, self._onEraseBackground)
self.Bind(wx.EVT_PAINT, self._onPaint)
self._mouseIn = self._mouseDown = False
def _onMouseEnter(self, event):
self._mouseIn = True
def _onMouseLeave(self, event):
self._mouseIn = False
def _onMouseDown(self, event):
self._mouseDown = True
def _onMouseUp(self, event):
self._mouseDown = False
self.sendButtonEvent()
def sendButtonEvent(self):
event = wx.CommandEvent(wx.wxEVT_COMMAND_BUTTON_CLICKED, self.GetId())
event.SetInt(0)
event.SetEventObject(self)
self.GetEventHandler().ProcessEvent(event)
def _onEraseBackground(self, event):
# reduce flicker
pass
def _onPaint(self, event):
dc = wx.BufferedPaintDC(self)
dc.SetFont(self.GetFont())
dc.SetBackground(wx.Brush(self.GetBackgroundColour()))
dc.Clear()
# draw whatever you want to draw
# draw glossy bitmaps e.g. dc.DrawBitmap
if self._mouseIn:
pass# on mouserover may be draw different bitmap
if self._mouseDown:
pass # draw different image text
found this code on stackoverflow
my objective is to make a label appear at the center of the widget and make it sink on its press
i couldnt find a way to change the border state of anything in wxpython
also, i made several calculations using the size of the control but got no results in positioning a text on the center with the dc.DrawText()
It would be a bad practice I think, but what i could is instead of inheriting from Control, inherit from panel and then make the panel clickable
but then the problem of not being able to sink it would come anyway
This might help you https://github.com/GimelStudio/gswidgetkit/blob/master/gswidgetkit/buttons.py
You could probably edit the code in that file to get that style
It's a custom wxPython widget toolkit
(I am one of the authors)
pretty neat... anyway, so much thanks, really have been searching for something like this for hours
Your welcome. I hope it helps
in reality... this project seems hella cool... I will dive deeper into it, seems a really useful thing for the framework
im working on a considerably big project rn, but for real someday i hope i can help with this
That would be appreciated 🙂
Full code: https://paste.pythondiscord.com/qoxaqivovo
So I have a label I created from this snippet:
def mw_attributes(self):
self.setWindowTitle(self.title)
self.setGeometry(self.left, self.top,self.width, self.height)
self.setFixedSize(self.size())
self.pixmap = QPixmap()
self.pokemon_image_screen = QLabel(self)
self.pokemon_image_screen.setPixmap(self.pixmap)
self.pokemon_image_screen.setGeometry(70, 80, 472, 460)
That is filled with an image from this url when this function runs:
def start_button_click(self):
url_image = requests.get(url_2)
image = QImage()
image.loadFromData(url_image.content)
self.pokemon_image_screen.setPixmap(QPixmap(image))
The issue is that the image it imports is just huge. I was wondering what the simplest way would be to resize the image to scale it down to something smaller?
I looked it up and have found Qt::AspectRatioMode in PyQt documentation: https://doc.qt.io/qt-6/qt.html#AspectRatioMode-enum
But it doesn't seem to transfer much to Python.
Someone discovered something similar in Stackoverflow but that was over a decade and a few versions of PyQt ago: https://stackoverflow.com/questions/21802868/python-how-to-resize-raster-image-with-pyqt
I hope this is the right channel for this, but I wanted to show you all an alternative to Colorama that I created a few years ago:
I never promoted it, but I've shown it to friends and have used it at work and on pet projects a ton
There are obviously a lot of libraries in python that color text that I have used, but I have used these other libraries and have never liked their syntaxes. For comparison, this is how you print a red, bold, underlined string in terminology:
from terminology import in_red
print(in_red('Danger').in_bold().underlined())
and this is how you do it with the other alternatives:
colorama
from colorama import Fore, Style
# Colorama doesn't support Underlined text because it
# is struggling to make it work for windows users
# https://github.com/tartley/colorama/issues/38
print(Fore.RED + Style.BRIGHT + 'Danger' + Style.NORMAL)
termcolor
from termcolor import colored
# The string args in this make's this susceptible to typos that are only caught in runtime.
# Other libraries that rely on strings: termcolor,
text = print(colored('Danger', 'red', attrs=['underline', 'bold']))
crayons
import crayons
# I actually am somewhat ok with the crayons syntax, but it
# doesn't support underlined text because it is a wrapper to colorama
print(crayons.red('Danger', bold=True)
blessings
from blessings import Terminal
t = Terminal()
# These function names are so dynamic that you can't use autocomplete in an editor/terminal,
# which is minor, but pretty annoying to me
t.bold_red_underline("Danger")
rich
from rich import print
# I find this syntax to be very annoying and a single typo can ruin all the formatting or cause an error
print("[bold red underline]Danger[/bold red underline]!")
one other thing I like is that the library's functions are idempotent, meaning in_red('text') == in_red(in_red('text')), which intuitively makes sense to me
import kivy
from kivy.app import App
from kivy.uix.label import Label
class Tigercargo(App):
def build(self):
return Label(text = "sa")
if name == 'app':
Tigercargo().run(
this code is not working please help :(
um
.run()
just add that parenthesis as I've told
!code next time please
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.
ok but I wrote to this channel beacuse I didnt know what parenthesis was
:(
fixed it
but still it doesnt work
dictionary works well if you don't know a word
be more explicit
it says "text provider ignored"
whoops
that doesn't sound like kivy logs
is that the full logs
the full log :[INFO ] [Logger ] Record log in C:\Users\Casper.kivy\logs\kivy_22-02-18_0.txt
[INFO ] [deps ] Successfully imported "kivy_deps.gstreamer" 0.3.3
[INFO ] [deps ] Successfully imported "kivy_deps.angle" 0.3.1
[INFO ] [deps ] Successfully imported "kivy_deps.glew" 0.3.0
[INFO ] [deps ] Successfully imported "kivy_deps.sdl2" 0.3.1
[INFO ] [Kivy ] v2.0.0
[INFO ] [Kivy ] Installed at "C:\Users\Casper\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\kivy_init_.py"
[INFO ] [Python ] v3.9.10 (tags/v3.9.10:f2f3f53, Jan 17 2022, 15:14:21) [MSC v.1929 64 bit (AMD64)]
[INFO ] [Python ] Interpreter at "C:\Users\Casper\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\python.exe"
[INFO ] [Factory ] 186 symbols loaded
[INFO ] [Image ] Providers: img_tex, img_dds, img_pil (img_sdl2, img_ffpyplayer ignored)
[INFO ] [Text ] Provider: pil(['text_sdl2'] ignored
wrap it in code block please
^^
I am sending it
edit it, wrap it in code blocks
I don't see errors though, it just says INFO
most likely you need to install sdl2
ok
nah you didnt
.
.
[INFO ] [deps ] Successfully imported "kivy_deps.gstreamer" 0.3.3
[INFO ] [deps ] Successfully imported "kivy_deps.angle" 0.3.1
[INFO ] [deps ] Successfully imported "kivy_deps.glew" 0.3.0
[INFO ] [deps ] Successfully imported "kivy_deps.sdl2" 0.3.1
[INFO ] [Kivy ] v2.0.0
[INFO ] [Kivy ] Installed at "C:\Users\Casper\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\kivy__init__.py"
[INFO ] [Python ] v3.9.10 (tags/v3.9.10:f2f3f53, Jan 17 2022, 15:14:21) [MSC v.1929 64 bit (AMD64)]
[INFO ] [Python ] Interpreter at "C:\Users\Casper\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\python.exe"
[INFO ] [Factory ] 186 symbols loaded
[INFO ] [Image ] Providers: img_tex, img_dds, img_pil (img_sdl2, img_ffpyplayer ignored)
[INFO ] [Text ] Provider: pil(['text_sdl2'] ignored
hahastaticpoop — bugün saat 10:36```,
either use a venv, build the latest nightly version or switch to a python.org version
crayons is just simple in nature so i prefer that.
Here, the GUI is looking a bit weird
I need help in
- Make it look better
- Put a space betwenn the 2 fields and labels
- Making phone number field look normal with there being 2 boxes, 1 for phone number code one for phone number
- Making it look neater
I'm currently writing a status bar, like polybar/waybar, for Windows with PyQt6. A few widgets I plan on writing, like a media player widget for example, rely on the winrt python module to retrieve information, e.g. currently playing media info.
I noticed that whenever I try to use (or even import) winrt within my PyQt application, the application will crash with
Traceback (most recent call last):
...
in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 850, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "C:\Users\den\PycharmProjects\yasb\src\core\widgets\win32\media_player.py", line 5, in <module>
from core.utils.win32 import media_control
File "C:\Users\den\PycharmProjects\yasb\src\core\utils\win32\media_control.py", line 3, in <module>
from winrt.windows.media.control import GlobalSystemMediaTransportControlsSessionManager
File "C:\Users\den\PycharmProjects\yasb\venv\lib\site-packages\winrt\__init__.py", line 4, in <module>
_winrt.init_apartment()
RuntimeError: Cannot change thread mode after it is set.
A hacky fix is to simply import winrt before PyQt is imported within main.py, but this will still result in PyQt outputting the error:
Qt warning: QWindowsContext: OleInitialize() failed: "COM error ..."
Has anyone ran into this before, and are there any better workarounds? I found this issue https://github.com/microsoft/xlang/issues/690 and it looks like init_apartment is called both by PyQt and then winrt. A forked version of winrt is also linked in the above issue, but I don't know how i'd install it.
After searching the discord, I've just found this message explaining OleInitialize, which makes sense: #help-pear message
But executing the QApplication in a different thread doesn't seem to fix the issue.
best ui?
You could try using ttk to make it look better. To make it come out neater, you could increase the padding. To make the phone number look more normal you could put the fields in a frame and put that frame in front of the Phone Number label. Also, it ought to be Generate Certificate instead of generate word if I am not wrong. The input fields can be aligned to the right of the window and the labels can be aligned to the left to make it look slightly better (Personal opinion). The submit buttons can be made more spread out.
PS: It doesn't look weird. It is fine.
Depends on what you want to do and how much time you wish to spend on learning it
android best ui
I think kivy is your only option there. I do recommend you use it with kivyMD
what is the difference
padding where?
ttk has slightly different widgets and you can set a theme for the entire window. You could look https://rdbende.github.io/tkinter-docs/resources/list-of-ttk-themes.html for some themes
List of ttk themes.
pady for everything in your form should be increased to make it more spread out
That often makes things look neater
Don't overdo it. Somewhere between 3-10 should be plenty
hi, what is more bueatiful than tkinter ?
Themed tkinter
Yea, I like crayons. My only problems with crayons right now is that it doesn't support changing the background color of text nor underlining text
any website for good bootstrap templates?
Themed Tkinter - very good
@digital rose
hi everyone need some help
def save_password():
if Website_.get() == "" or Username_.get() == "" or Password_.get() == "":
window = Tk()
Error_Message = Label(window, text = "Error! Please fill all the above fields.", bg = "red", fg = "white", font = ("Arial", 16))
Error_Message.pack()
window.mainloop()
else:
with open("Passwords.txt" , 'a') as file:
file.write(Website_.get() + "|" + Username_.get() + "|" + Password_.get() + "\n")
window = Tk()
Message = Label(window, text = "Password successfully saved.", bg = "green", fg = "white", font = ("Arial", 16))
Message.pack()
window.mainloop()
can anyone tell me why the window is not created in tkinter even though the password to file is saved
what
Hello, Anyone here can help me with ploting animation tkinter?
i think it One Dark Pro or Dracula Official or Sublime Material Theme or something like that.
those all themes in VS Code.
if you are using VS Code see:
https://www.tabnine.com/blog/top-vscode-themes/
if you are using neovim/vim see:
https://www.dunebook.com/best-vim-themes/
if you are using Sublime Text see:
https://www.tabnine.com/blog/top-themes-for-sublime-text-editor/
if you are using IntelliJ see:
https://www.tabnine.com/blog/5-best-intellij-themes/
I hope you will find yours 👍🏼
thank you
you are welcome 👍🏼
are you using grid() widgets management ?
yes as i see in your main.py
i recommend to you to do:
window = Tk()
# Hide
window.withdraw()
.
.
.
def savepassword():
if Website.get() == "" or Username.get() == "" or Password.get() == "":
# Show
window.deiconify()
Error_Message = Label(window, text = "Error! Please fill all the above fields.",
bg = "red", fg = "white", font = ("Arial", 16))
ErrorMessage.pack()
else:
# Show
window.deiconify()
with open("Passwords.txt" , 'a') as file:
file.write(Website.get() + "|" + Username.get() + "|" + Password.get() + "\n")
Message = Label(window, text = "Password successfully saved.", bg = "green",
fg = "white", font = ("Arial", 16))
Message.pack()
.
.
.
window.mainloop()
if the window was your main window
otherwise i advice you to use Toplevel():
def savepassword():
if Website.get() == "" or Username.get() == "" or Password.get() == "":
window = Toplevel()
Error_Message = Label(window, text = "Error! Please fill all the above fields.",
bg = "red", fg = "white", font = ("Arial", 16))
ErrorMessage.pack()
else:
window = Toplevel()
with open("Passwords.txt" , 'a') as file:
file.write(Website.get() + "|" + Username.get() + "|" + Password.get() + "\n")
Message = Label(window, text = "Password successfully saved.", bg = "green",
fg = "white", font = ("Arial", 16))
Message.pack()
-
Make it look better:
usingbg,fg,activebackground,activeforegroundandbd. -
Put a space between the 2 fields and labels:
if you are usinggridyou should usepadyandpadxfrom their names thepadymake a space in the y position and the same for thepadxbut in the x position. done via:
X.grid(row=N, column=N, padx=N, pady=N) # X = your widget, N = your number
- Making phone number field look normal with there being 2 boxes, 1 for phone number code one for phone number:
i think by using thecolumnspanwhich can be done by (am not good at grid because i think place better than grid):
X.grid(...., columnspan=N) # X = your widget, N = your number
- Making it look neater
i don't know what you want exactly do you want better UI look or ?
Note: the tkinter \ Tcl\Tk are a basic GUI library and not fancy GUI library like PyQt5.
im using PyQt, I get this error
TypeError: addWidget(self, QWidget, stretch: int = 0, alignment: Union[Qt.Alignment, Qt.AlignmentFlag] = Qt.Alignment()): argument 1 has unexpected type 'sip.wrappertype'
why my tkinter bind buttons work incorrectly?
when i go on start bottun with mouse, about button will change!
this is my code:
def btns(self, x, y, text, bg, fg):
def on_enter(ctx):
self.btn['background'] = fg
self.btn['foreground'] = bg
def on_leave(ctx):
self.btn['background'] = bg
self.btn['foreground'] = fg
# button
self.btn = tk.Button(self, text=text, bg=bg, fg=fg, activebackground=fg, activeforeground=bg, border=0, width=42, height=2)
self.btn.bind('<Enter>', on_enter)
self.btn.bind('<Leave>', on_leave)
self.btn.place(x=x, y=y)
if __name__ == '__main__':
window = Panel()
window.label()
window.btns(0, 190, 'S T A R T', '#2b2e37', '#56fc03')
window.btns(0, 230, 'A B O U T', '#2b2e37', '#f5ec42')
window.mainloop()
i think i wrote my oop code incorrectly
i wrote this simple and worked
thanks
anyone familiary with pyside6 or pyqt?
I am looking at one of the examples in the docs and cannot figure out how to get it to run
because they are the same in your code
the self.btn you created from it the START button is the same as ABOUT button
sorry not me, am only tkinter 👍🏼
nice 👍🏼
Tnx bro for your help
you are welcome
Anyone know how to embed a Matplotlib figure in a tkinter window and also support high resolution displays? I posted my question on Stack Overflow but haven't gotten much help. https://stackoverflow.com/q/71191121/1084875
use Pygame
I want to do this with PyQt5, but I'm not really sure where to look (sorry for the scuffed representation lol)
Pygame supports Matplotlib figures?
Using PySimpleGUI
couldn't recognize data in image file "foo.png", can someone help me out?
maybe your file is not exists or invalid ?
I'm not sure, I can see and open it on windows so it does exist
You can't make blur in tkinter.
but you can work charts with Matplotlib in tkinter: https://datatofish.com/matplotlib-charts-tkinter-gui/
yes, I mean the path
if you can show me your code
1 second, i wanna try something out
👍🏼 .
you mean you want to place widgets in the edges of your window ?
using PyQt5
app.tk.call('tk', 'scaling', 1.2) ?
make the float a bit smaller
import urllib.request
import PySimpleGUI as sg
layout = [
[sg.Image(r'',key='img1')],
[sg.B('PlaceHolderButton',key='Button'), sg.B('Exit')],
[sg.I(key="URL")]
]
window = sg.Window('PySimpleGUI Test',layout,size=(200,100))
while True:
event, values = window.read()
if event == 'Exit':
break
if event == 'Button':
print(values['URL'])
urllib.request.urlretrieve(f"https://i.ytimg.com/vi/{values['URL']}/hqdefault.jpg?sqp=-oaymwEbCKgBEF5IVfKriqkDDggBFQAAiEIYAXABwAEG&rs=AOn4CLCS6cs4L97xxnXYTOVP7q7CMrN0Gw",'thumb_0.png')
window['img1'].update(r'thumb_0.png')```
I am able to download the image and everything, but I can't open it in pysimplegui
if you can save it in a real path will be better:
urllib.request.urlretrieve(f"https://i.ytimg.com/vi/{values['URL']}/hqdefault.jpg?sqp=-oaymwEbCKgBEF5IVfKriqkDDggBFQAAiEIYAXABwAEG&rs=AOn4CLCS6cs4L97xxnXYTOVP7q7CMrN0Gw",'C:\\Blah\\thumb_0.png')
window['img1'].update('C:\\Blah\\thumb_0.png')
and i think if you want to change the image you should use Pillow
from PIL import Image, ImageTk
.
.
urllib.request.urlretrieve(f"https://i.ytimg.com/vi/{values['URL']}/hqdefault.jpg?sqp=-oaymwEbCKgBEF5IVfKriqkDDggBFQAAiEIYAXABwAEG&rs=AOn4CLCS6cs4L97xxnXYTOVP7q7CMrN0Gw",'C:\\Blah\\thumb_0.png')
im = Image.open('C:\\Blah\\thumb_0.png')
image = ImageTk.PhotoImage(image=im)
window['img1'].update(data=image)
as the StackOverFlow showing:
https://stackoverflow.com/questions/67079155/displaying-an-image-using-pysimplegui-without-having-to-use-an-event-listener
because am bad at PySimpleGUI 👍🏼
another link maybe help you:
https://github.com/PySimpleGUI/PySimpleGUI/issues/1156
that.. worked
Thanks a lot
you are welcome 👍🏼
You'll want to get Qt Designer
It's a drag and drop interface where you can make exactly that
and once finished you can export it into a python file and program all the buttons and things like that
Sounds good, tysm
def page2():
screen2=Frame(root,bg='#8644f4')
screen2.place(x=1000,y=700)
search=Label(screen2,text='Search')
search.pack()
def logcheck():
user= str(user_entry.get)
psw= str(pw_entry.get())
if user=="h" or psw=="h":
messagebox.showinfo('cool','you have logged in successfully')
page2()
elif user=="" and psw=="":
messagebox.showerror('Error''All fields required')
else:
messagebox.showerror('error','Invalid Username/Password')
not able to show other frame using function page2
hey guys, ive been stuck for integrating gmaps into the tkinter. anyone know how to solve?
filter, with tkinter
Hey! Does anyone know from where we can get mentors to guide us? Like I need for ui ux!!
Since I am at beginner stage ibneed someone whose advice or tips I can follow!
Hi, I'm coding a GUI using Tkinter which computes financial calculations across 3 different tabs. I have created the tabs and included a dropdown options menu on tab 1 to pick from gross margin, operating margin and net profit margin. I have been trying to code a function that includes if and elif statements so that when the user for example picks gross margin, I want a textbox and entry button to appear where the user can input values. However, I don't understand how to do this. Any thoughts? This is the code:
import tkinter as tk
from tkinter import ttk
root = tk.Tk()
root.title("Tab Widget")
tabControl = ttk.Notebook(root)
tab1 = ttk.Frame(tabControl)
tab2 = ttk.Frame(tabControl)
tab3 = ttk.Frame(tabControl)
tabControl.add(tab1, text='Tab 1')
tabControl.add(tab2, text='Tab 2')
tabControl.add(tab3, text='Tab 3')
tabControl.pack(expand=1, fill="both")
OPTIONS = ["Gross Margin", "Operating Margin", "Net Profit Margin"]
variable = tk.StringVar(root)
variable.set("Pick a calculation")
w = tk.OptionMenu(tab1, variable, *OPTIONS)
w.grid(column=0, row=1)
ttk.Label(tab1,
text="Profitability Ratios").grid(column=0, row=0, padx=30, pady=30)
ttk.Label(tab2,
text="Lets dive into the world of computers").grid(column=0, row=0, padx=30, pady=30)
ttk.Label(tab3,
text="My third tab for my coursework").grid(column=0, row=0, padx=30, pady=30)
def gross_margin():
if tk.OptionMenu == OPTIONS[0]:
gp = Label(root, tab1, text="Enter Gross Profit Value:", command=gross_margin()).pack()
gpe = Entry(root, tab1, textvariable=grossprofit, command=gross_margin()).pack()
salesentry = Label(root, tab1, text="Enter Sales Value:", command=gross_margin()).pack()
salese = Entry(root, tab1, textvariable=sales, command=gross_margin()).pack()
x = gpe / salese
Label(root, tab1, text=x, command=gross_margin()).pack()
root.mainloop()
Which gui is best?
I need some help with pyqt5
I am trying to create a chart
Which will have multiple datas
But users have to drag to see the previous data
Like imagine I am making a chart for the popularities of programming languages
And lot of programing languages will be listed there
Imagine python is also there
So users will be able to see the popularity of python from 2010-2022
If they wants to see earlier, they have to drag the chart left
They can even resize the chart to however they wants
Like if they wants data from 2000-2022 they have to make the bottom row bigger
I mean you understood
If anyone helps then please ping me
You can say I am basically trying to make a tick chart
I was making a listbox that displays the contents of a list in a for loop. Then I added a function that adds content to the list, but the new content does not show up in listbox. Am I doing something wrong with the order of code?
This is a small part of the program I am making.
window = Tk()
nameList = ["Joe", "JoeNathon", "Joestar", "Joelly"]
def add_name():
nameList.append("FunnyNameXd")
listBox = Listbox(window)
listBox.pack(pady=15)
addButton = Button(window, text="Add", command=add_name)
addButton.pack(pady=5)
for i in nameList:
listBox.insert(END, i)
window.geometry("300x300")
window.mainloop()
are u destroying the previous frame?
make sure the page2 function is being defined inside a function made for page1
and screen1 defined before the page2 function
Just add
Tk.update(listBox)``` (or window if listBox doesn't work)
To your function. That ought to fix it.
nope
I was wondering how it would update since it isnt in a loop.Thank you so much!
Im sorry but it appears to not be working, not even if i change listBox to window in parameters. I tried to put that in the "add_name" function and placed it after declaring listBox. Am i missing something?
but i figured it out after looking through webs, thanks!
Hello, hi use PyQt5 but i don't find how to switch a window by an other, do you have any ideas ?
(i have get my code by Qt designer)
Heyas, Good Morning!
Some PyQt5 Guru here?
I try with self.emp.treeViewFolderView.expandAll() but it dont expand the Folders oO any ideas?
i succeed
i need help i m facing this issue while installing tkinter on raspi4 B
What is the python version you are using?
BTW, tkinter is pre-installed with python as far as I know. I believe you can use it right out of the box.
just typing python3 in terminal followed by from tkinter import * should tell you if it is installed or not
its fixed brother after lot of efforts
Is it possible to use Pygame and Tkinter at the same time? Im making a sudoku game. I want to display statistics of the game after the game is over and i want a menu through which the player can select the next sudoku puzzle to play.
or a way to embed pygame into tkinter
or can i have it so that when i press a button on the tkinter GUI, pygame starts?
when it ends i can use the data collected while the user was playing to display stats in tkinter after pygame ends?
good idea
This is possible. You can make your game and pull it up by pressing a tkinter button. The simplest way in my opinion would be to make your game as a different file and the use the os.system("python path/to/game/file.py")
That would pull up your game on the press of a button I think.
try this
pip3 install tk
Finally solved
👍 👍 👍
how to use while loop in tkinter with after method?
doing a while loop would probably freeze the gui, hence the after method helps, you can set a function to be called in a specific delay with after function
anyone know how to work with pysimplegui and keyboard packages??
i wanna know how to make it so when i press enter on my keyboard something happens in my window that i made with pysimplegui
does anyone know how to refer to a different screen when dealing with kivy
https://paste.pythondiscord.com/noxayefope trying to make MainWindow TotalAmount function to work
What Operating system are u using?
i know
let me check ur code
Its Twister os on rpi4 B
That problem is fixed man btw thank for help
Wdym by refer? U mean change screen?
if you are looking to change screen then kivy has documentation on ithttps://kivy.org/doc/stable/api-kivy.uix.screenmanager.html
Yo what GUI is this?
Vue.js, fully custom HTML/CSS/SCSS
I have a list of tasks that take some time to do that should be run successively. The tasks are in a tkinter Treeview and display their statuses in a column.
def start(self):
for item in self.queue.get_children():
if self.queue.set(item, "status") == "":
self.job = Job()
self.thread = threading.Thread(target=self.job.run)
self.thread.start()
self.monitor_progress(item)
# Stop here without freezing the entire interface
print("Complete")
def monitor_progress(self, queue_item):
if self.thread.is_alive():
self.queue.set(queue_item, "status", self.job.progress)
self.after(100, lambda: self.monitor_progress(queue_item))
else:
self.queue.set(queue_item, "status", "Complete")```
`monitor_progress` is used to update the column with the status. The issue is the loop continues after the call to `monitor_progress` which makes all tasks run at the same time.
I thought after() calling itself would make the script stop there but apparently not 🤔 How should I make the loop stop running until the thread exits without freezing the entire interface?
Well I managed to fix this by putting a self.thread.join() inplace of the comment there and putting the whole start function in another thread
Hi, I need help with a project I've been doing. So here's what I want:
I have 2 monitor screens. My main one is simply a usual screen to code and stuff, the other one will have no other function other than display an image in full screen. I want to be able to control the image displayed on the second screen like so:
while True:
#Do stuff
secondScreen.update_image(numpy_array)
#Do more stuff
My problem/challenge is: I want to do this as simple as possible. What I've done so far is to use PyQt5 and create a widget that will be displayed on the second screen, and all the event handling is done from the main thread, while the data processing is done on the separate thread and they communicate through signals, that is:
class mainWidget(QWidget):
def __init__(self):
#init stuff
secondMonitorWidget.showFullscreen()
self.startThread()
@pyqtSlot()
def update_image(self,img):
secondMonitorWidget.update_image(img)
def startThread(self):
thread=QThread()
thread.new_img_signal.connect(self.update_image)
class worker(QThread):
new_img_signal=pyqtsignal(np.ndarray)
def __init__(self):
#init_stuff
def run(self):
#Do stuff
new_img_signal.emit(array)
#Do more stuff
This is one way to do it, and it somehow works, but it feels like taking a tank to kill a fly. The most annoying part is that it forces me to have an event loop where there will be no events to detect on the GUI. Is there no other way to achieve this in a much simpler form?
(This is a lot of pseudo-code but I think the message gets across)
hello
cam any one help me i am getting weird issue
i am using messagebox.askquestion prompt it works fine but
when i close my root window
ask question prompt re appears
what could be the issue?
in tkinter, you can simply bind the keypresses to certain functions
otherwise you can also use the keyboard pypi package
i need help
tip, you could straight up ask the question instead of saying that 👀
'NoneType' object has no attribute 'tk' how to solve this error while insering values into entry box in tkinter
any one please tell me why i am getting same message prompt again after closing my Application
here is what i am using to display error msg
tk.messagebox.askquestion(title = 'Wrong Input', message = 'Did you mean?' + " " + show , icon='warning')
and the 2nd one u can see in gif
if i wanted to get the index of the selected item in a listbox, what function would i use in tkinter?
maybe you can find that in tkinter listbox docs..
i browsed a lot, but i dont seem to find anything that grabs the index of the selected item
could u share any?
wait
do you want to get the index of listbox's element to delete that?
removing that..
yes!
from tkinter import *
import tkinter.messagebox as msg
"""
List box is a widget in tkinter which basically works like a list, where we want to show items
in a similar way then we can use List Box widget.
"""
root = Tk()
root.geometry("550x460")
root.title("Listbox inside our GUI")
root.config(bg="#67ebd9")
def do_element(command):
"""This function adds element in our List box through the value entered by the user in entry widget's variable value"""
if command == "add":
if list_element.get () == "":
msg.showinfo("Error !!", "Enter item name in box below to insert it in list. Don't let it empty.")
return
list1.insert(ACTIVE, f"{list_element.get()}")
list_element.set("")
elif command == "delete":
list1.delete(ACTIVE)
# Main heading Label.
Label(root, text="List of tkinter widgets", font=("constantia", 30), bg="#f6ffcf").pack(fill=X, side=TOP, pady=7)
list1 = Listbox(root, background="#cef2ed", font=("georgia", 12, "italic"))
list1.pack(pady=20)
# Setting values of Listbox which will be their as default values.
list1.insert(1, "Label")
list1.insert(1, "Listbox")
list1.insert(1, "Button")
list1.insert(1, "Radiobutton")
list_element = StringVar()
# Making entery widget for getting value of another elements for adding in Listbox.
Entry(root, textvariable=list_element, font=("book antiqua", 12)).pack(ipady=7, pady=15)
frame1 = Frame(root, borderwidth=5, height=200, bg="#67ebd9")
frame1.pack(side=BOTTOM, pady=15)
# Our button which will add element in list box by add_element() function.
Button(frame1, text="Add element", font="comicsans 15", command=lambda: do_element("add")).pack(pady=4, padx=7, side=LEFT)
Button(frame1, text="Remove element", font="comicsans 15", command=lambda: do_element("delete")).pack(pady=4, side=LEFT)
root.mainloop()
checkout this
the code looks really good
ah yes
You just select that element and click remove element button .. that will be deleted.
that works too, but i need the index to remove the object from a list too
so is there like a method "ACTIVE.index"
idk
thank you, i will be sure to
Hello Guys, Just a doubt with tkinter, how can we give spaces between two widgets ? For e.g. in the given figure how can I minimize the space between two buttons? I am new in UI so please don't mind the design 😅 😅 I will refactor the size and design later.
are u packing the buttons or placing them?
i have used grid()
Reduce the padx and pady in the .grid()
Can i post GitHub links here ?For showcasing project ?
http://www-stone.ch.cam.ac.uk/documentation/rrf/rpn.html
it would be good to know for you smth like Reverse Polish Notation
then your calculator could be used to calculate expressions like (3 + 5) * (7 – 2), instead of just two numbers
Ok I'll check it thanks for suggestions
Thanks. I found the bug.
Can someone please clarify, why the same button orientation (height and width) appears different in mac OS and different in Windows? Does Canvas behaves differently with OS?
use frontend+backend frameworks?
my desktop app is based on pyqt5 and tkinter. what do you suggest?
Thinking which functionality it has
Deciding what can be implemented in frontend, what can be implemented in backend
Deciding, if wishing and capable to do it
Doing it
If not capable doing due to lack of skills, then describing what u wish to implement... And getting advice for minimal stuff to learn in order to implement it
This is not sufficient description to give advice what u need in a more precise manner
And that is with assumption I understood correctly that u wish to reimplement your app in form of web site
So, I have an app with login system. What it basically does is whenever i search in search bar it check the details about certain word in my mysql database server and shows info about it accordingly. It has a username system and it basically keeps record of all searched data, IP, time and surfing of certain user. But, currently it is client side and database credential is at risk.
if u wish to remove database credentials risk, just make some Backend Rest API in flask/django/fastapi, that does database connection for your application
and exposes public endpoint to query in https request
you can query it even with your pyqt application
The functionality of frontend looks simple, I think you can implement it in the same backend framework without diving into frontend
then you could simplify your logic, and to be not exposing connection to database as rest api
just do it directly in backend framework and render html images as responses
thanks this is really helpful
@rocky dragon Have you run into any issues with porting PySide2 QThread or QRunnable code to PySide6?
Don't think I have, but most of the threads I had before were simple and I converted them to using Qt methods (e.g. network requests)
Is there any tkinter application where the inheritance is used to add some custom attributes to modify a widget(like button, lable etc) class
I am making an app (nearly intermediate level) and this time i wanted to add some other attributes in constructor my xyz class inheriting from frame class
Anyone has a link to some custom Layout for PyQt/Pyside.
Like actually Layout subclasses. I would like to create my own, but the only examples I can find are either extremely convoluted nested Layouts or from the Pyside Doc and they either are in C++ or some python look a like pseudo code language.
Thanks!
Hi, I've been trying to help a classmate diagnose an issue he was having with validating input in a Tkinter Entry() widget... it now only accepts numbers, the only issue now is that the value of the two entries, when printed, are ".!entry" and ".!entry2". For context, the programs purpose is to take the given radius and height of a cylinder, and will output the surface area and volume of said cylinder.
Hey @analog spire!
It looks like you tried to attach a Python file - please use a code-pasting service such as https://paste.pythondiscord.com
You're printing out the widgets themselves. They just return the internal Tk name/ID when str() is called on them by print(), which looks like that. You probably wanted to call .get(), or print the values you already had + the result?
Also, the surface area/volume display code isn't going to be run again when you set variables, you need to update the widgets yourself.
I'm not sure why you're putting things in a canvas, it's not required. Canvas widgets are for things like drawing lines and shapes in a region. For just positioning widgets, the pack, grid and place managers are far better.
pack() is kinda simple, you specify a side and it puts widgets in place. Makes it easy to use, but less customisable.
Sup Carrot? I can help you with tkinter.
grid() positions widgets in rows/columns, and is what you usually want to use.
place() does what you are doing with the canvas, places stuff at specific X/Y coordinates. The others check the size of the widget and move stuff around to match.
So the problem with text boxes in tkinter, is that they automatically insert some weird character at the beginning of the string. So just put a quick if statement: if the the string length is greater than 0 cut off the first character.
Oops, never mind, it puts a weird character at the end not the beginning.
What character?
lol all good. thank you, i'll give it a go
I'm not entirely sure...
I've not had that happen.
note that the only reason i'm here is to get the calculation function itself to operate, it's his job to create the ui itself
but i'll pass it along
Ah.
I'm using the ScrolledText object when I get that weird idiosyncrisy.
What you should perhaps be doing is use your DoubleVar objects. They're linked to the entry widgets, so you can call get() to fetch the data as a float.
Yeah, but you're then calling float() which is a little pointless.
I'm reading the code now... comments would have been nice...
^ i agree
can you tell me what self.rad is ? What's a tk.Doublevar ?
from my understanding DoubleVar simply returns the float from the input in the Entry widgets, which makes sense as to what Spen was saying
self.rad is simply a variable called "rad" within the class
Well you're treating self.rad as like a textbox or something. What's the point of the .get() call if it's just tkinters internal double variable type?
That's correct.
A tk variable is more like a named holder of a value - other things can register with it, and get notified when it changes.
So for instance you can pass the same variable to multiple widgets, and then editing one has the others update in sync.
got it sorted, thank you guys for your help, i'll be sure to pass along the other stuff as well :)
Wait, so what's the bug?
I mean, it seems that the data is being calculated... but it's just not being displayed. Uh, where exactly is the label where the output goes?
turns out the issue wasn't the calculation at all as spen pointed out here (other than converting to floats which we got sorted with DoubleVar), but yes, it was how it was being outputted that was the problem
we got a bit of tunnel-vision there, sorry for the confusion
Glad we could help. Yeah, I wish that I could follow the code better.
Post the fixed version.
Reading other people's code is interesting. I hear that as a professional, reading other people's code and modifying it is like a bread and butter skill.
https://github.com/sryu1/YouTube_View_Bot I created a youtube view bot, how does it look? any feedback? also the webserver is useless in there.
how can i program a custom title bar like in vscode using pyqt6, with the topbar being on the samel level as the title of the application n the minimize, maximize n close buttons, with custom icons for the 3 btns?
(plz ping when reply)
_
What's the script to create a basic ui?
I want to create a test program that might be useful later
Uhh doing this much work is also pain when the ui is outdated 😂, layout managers are sometimes paint when not work properly
Just a static prototype for my "Too Doo" app
gonna sound stupid here but is pysimplegui better than tkinter? i've always had trouble writing efficient code without overly long lines for the simplest text and idk how to shorten it or just make it readable
like i dont want to have a code that's 2/3 of gui
Idk, i never went out of tkinter 😀
From what I’ve seen, pysimplegui is a little more straightforward than Tkinter for a beginner UI
I’m curious what flask is for in this?
I tried creating a webserver that shows info of the bot but it's a bit useless
should I get rid of it?
Ah, no that seems like a worthwhile endeavor IMO
Or you can use web hooks and show on discord
Why wouldn't they work properly
What's the quickest way to create a desktop GUI (windows)? What language/framework to use?
could anyone help me with an HTML inline question?
i use pyqt5
Aah that was some lots of tries to get the correct settings for this
Tkinter is easy to use and code
is anyone having issues with kivymd MDChip? I keep getting error pos_hint But I have not used pos_hint anywhere yet. I checked kitchen_sink demo and same error
pysimplegui, very easy (Python)
QT Designer is a GUI that allows you to use your mouse to place objects where you want them then convert the .ui file to .py.
The learning curve is a little harder than Tkinter, but once you get the hang of it you'll never go back to Tkinter. If you are interested in making modern GUIs, PyQt5 is the way to go.
I'm making a typing game with tkinter, where you have to type a certain number of words before the timer finishes. To implement the timer I used threads, which seemingly works, but I still get an error each time my program closes (thread is not in main thread). I was wondering if there was a way to add a timer without using threads since tkinter is not thread safe ?
A PyQt5 question:
I am using the designer and loading the form ui through loadUi method.
Right now my source code directory layout is like:
main.py
mainform.ui
...
I create an executable via pyinstaller. If the executable runs in a directory other than the project root directory, the program throws an exception that it cannot find eg. mainform.ui.
I think I understand why this happens, but shall I better define the UI paths, somewhere in a .spec file?
Can otherwise the design files be 'embedded' in the executable?
U can use methods like
Tk().update()
Tk().update_idletasks()
As per my experience idletask just displays the tasks which are currently done inside the function its currently running
Whereas update will go for the current task u doing like if u dragging the window what u will notice is that the window is moving but things running indie has been paused
But in case of idletask the window stores ur drags and after the function is done it will do that window drag task
.
But if u still going with thread option so u can do is that
# if thread2 os the thread u made
thread2.join()
This will do the work and that will join the mthread running the main code
I am learning tkinter, any projects ideas to try?
Thanks! :)
filename='password.txt')
await ctx.send(file=file)
else:
embed = nextcord.Embed(title="Snipe",
Else is error anyone know why
U cant acess that like this, and code isnt fully visible
Some play projects I have seen but not for TkInter are a calculator, tic tac toe and a to-do list
What is Tk().update()? Are you creating a tcl interpreter just to update the existing event loop?
No this is just an update method provides to view the changes in real time when tkinter os running a function having a endless loop so if we have this method there in loop it will also act to the commands we are giving, just jad less experience in this method (i used it in some of the projects only)
does anyone know kivy enough to help or at least tell me what to google because I cant find what I'm looking for. I want to create a dropdown menu from a list
Can I change the master of a widget in tkinter, for example I want a button to go from a LabelFrame to other LabelFrame, is it possible?
No
What I meant is, don't use Tk().update(). Instead use any_widget.update()
Once created, a master is not changeable
You can copy the settings and recreate the widget for the new frame
help. i can’t install pyqt5, pyqt5-tools and kivy. i get this error every time(python 3.10.2) in cmd
i tried(in cmd):
python -m pip install pyqt5
python -m pip install pyqt5-tools
python -m pip install kivy
K
i also used kivy_venv to install kivy but it didn’t work
Do pip install pyqt5 works?
no, it says pip is not an internal or external command
https://youtu.be/kxSuHyQfStA
Try this
Tutorial to install and setup PyQt5 as well as use PyQt5 Designer for drag-and-drop GUI design. Learn how to launch and create your first GUI for Python programs and desktop applications.
In this tutorial, you will learn how to create your first Python Graphical User Interface. The first step you will perform is downloading and installing PyQt5...
also is it possible to somehow download the files from the internet
ok, i’ll try
You need to add the scripts python folder to the system path first
how can i do that
Google it, various tutorials out there
In this tutorial you will learn How to Add Python Installation to Path Environment variable in Windows 10.
When we install we have an option to set the path. but by default this option is not selected.
Here first we need to find the location / folder here Python is installed and then we have to add that to Path in System variables section.
Ever...
but do i need it if i can use “python -m pip is install”
sorry if asked stupid questions (i’m a beginner)
Got it
No but it is always a good idea to add to path, you will need it in the future mostly
It is not a huge task, but none the less, that might not solve your original issue
ok thanks.
also do i need some kind of license to install and use pyqt5 qt
No
i saw that on qt website
But the last time I tried to install this( a few months back ), it wasnt supported on python 3.10 yet, so might want to check the compatible version of python and then proceed
You need a license if you are commercially publishing your application.
But I am not much aware about that aspect
ok
95% confident it works with python 3.8 atleast
ok thanks
and also dont post pictures of errors, like in this example, it is hard for others to see the error. If you are posting such images make sure the text is clearly visible(might want to zoom in) or paste the text(not directly)
ok
omg it worked thanks a lot
guys i'm trying to learn kivy and i'm wondering how you can make a scatter layout translate its children widgets 1 to 1 with itself (so as to maintain relative placement within itself) and also how to restrain it to stay inside the main window
or zoom out the main window to keep the scatter inside ig that works too but i'd preffer the scatter the bound inside the window for translation and maybe only zoom out for rotation and only allow the scatter getting oob when scaled larger than the main window (or whichever container it's in)
Hello so I saw someone doing this:
print(f"{Fore.BLUE} ███▄ ▄███▓▓█████ ██▀███ ▄████▄ █ ██ ██▀███ ▓██ ██▓")
print(f"{Fore.BLUE} ▓██▒▀█▀ ██▒▓█ ▀ ▓██ ▒ ██▒▒██▀ ▀█ ██ ▓██▒▓██ ▒ ██▒▒██ ██▒")
print(f"{Fore.BLUE} ▓██ ▓██░▒███ ▓██ ░▄█ ▒▒▓█ ▄ ▓██ ▒██░▓██ ░▄█ ▒ ▒██ ██░")
print(f"{Fore.BLUE} ▒██ ▒██ ▒▓█ ▄ ▒██▀▀█▄ ▒▓▓▄ ▄██▒▓▓█ ░██░▒██▀▀█▄ ░ ▐██▓░")
print(f"{Fore.BLUE} ▒██▒ ░██▒░▒████▒░██▓ ▒██▒▒ ▓███▀ ░▒▒█████▓ ░██▓ ▒██▒ ░ ██▒▓░")
print(f"{Fore.BLUE} ░ ▒░ ░ ░░░ ▒░ ░░ ▒▓ ░▒▓░░ ░▒ ▒ ░░▒▓▒ ▒ ▒ ░ ▒▓ ░▒▓░ ██▒▒▒ ")
print(f"{Fore.BLUE} ░ ░ ░ ░ ░ ░ ░▒ ░ ▒░ ░ ▒ ░░▒░ ░ ░ ░▒ ░ ▒░▓██ ░▒░ ")
print(f"{Fore.BLUE} ░ ░ ░ ░░ ░ ░ ░░░ ░ ░ ░░ ░ ▒ ▒ ░░ ")
print(f"{Fore.BLUE} ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ")
print(f"{Fore.BLUE} ░ ░ ░ ")``` is there a more efficient way
hi , I am trying to implement some coding challenges from the coding train .which GUI libraries is/are required or I can start with for 2d/3d?
Yes, there is
Ok how would you do it
I would use a list
Like print(“
Fjskdi
“)
store the text as one string with newlines, and print it
i got it
Yes
print(Fore.BLUE+"""
███▄ ▄███▓▓█████ ██▀███ ▄████▄ █ ██ ██▀███ ▓██ ██▓
▓██▒▀█▀ ██▒▓█ ▀ ▓██ ▒ ██▒▒██▀ ▀█ ██ ▓██▒▓██ ▒ ██▒▒██ ██▒
▓██ ▓██░▒███ ▓██ ░▄█ ▒▒▓█ ▄ ▓██ ▒██░▓██ ░▄█ ▒ ▒██ ██░
▒██ ▒██ ▒▓█ ▄ ▒██▀▀█▄ ▒▓▓▄ ▄██▒▓▓█ ░██░▒██▀▀█▄ ░ ▐██▓░
▒██▒ ░██▒░▒████▒░██▓ ▒██▒▒ ▓███▀ ░▒▒█████▓ ░██▓ ▒██▒ ░ ██▒▓░
░ ▒░ ░ ░░░ ▒░ ░░ ▒▓ ░▒▓░░ ░▒ ▒ ░░▒▓▒ ▒ ▒ ░ ▒▓ ░▒▓░ ██▒▒▒
░ ░ ░ ░ ░ ░ ░▒ ░ ▒░ ░ ▒ ░░▒░ ░ ░ ░▒ ░ ▒░▓██ ░▒░
░ ░ ░ ░░ ░ ░ ░░░ ░ ░ ░░ ░ ▒ ▒ ░░
░ ░ ░ ░ ░ ░ ░ ░ ░ ░
░ ░ ░ """+Style.RESET_ALL)
!e
print(Fore.BLUE+"""
███▄ ▄███▓▓█████ ██▀███ ▄████▄ █ ██ ██▀███ ▓██ ██▓
▓██▒▀█▀ ██▒▓█ ▀ ▓██ ▒ ██▒▒██▀ ▀█ ██ ▓██▒▓██ ▒ ██▒▒██ ██▒
▓██ ▓██░▒███ ▓██ ░▄█ ▒▒▓█ ▄ ▓██ ▒██░▓██ ░▄█ ▒ ▒██ ██░
▒██ ▒██ ▒▓█ ▄ ▒██▀▀█▄ ▒▓▓▄ ▄██▒▓▓█ ░██░▒██▀▀█▄ ░ ▐██▓░
▒██▒ ░██▒░▒████▒░██▓ ▒██▒▒ ▓███▀ ░▒▒█████▓ ░██▓ ▒██▒ ░ ██▒▓░
░ ▒░ ░ ░░░ ▒░ ░░ ▒▓ ░▒▓░░ ░▒ ▒ ░░▒▓▒ ▒ ▒ ░ ▒▓ ░▒▓░ ██▒▒▒
░ ░ ░ ░ ░ ░ ░▒ ░ ▒░ ░ ▒ ░░▒░ ░ ░ ░▒ ░ ▒░▓██ ░▒░
░ ░ ░ ░░ ░ ░ ░░░ ░ ░ ░░ ░ ▒ ▒ ░░
░ ░ ░ ░ ░ ░ ░ ░ ░ ░
░ ░ ░ """+Style.RESET_ALL)
@digital rose :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 1, in <module>
003 | NameError: name 'Fore' is not defined
!e
from colorama import *
print(Fore.BLUE+"""
███▄ ▄███▓▓█████ ██▀███ ▄████▄ █ ██ ██▀███ ▓██ ██▓
▓██▒▀█▀ ██▒▓█ ▀ ▓██ ▒ ██▒▒██▀ ▀█ ██ ▓██▒▓██ ▒ ██▒▒██ ██▒
▓██ ▓██░▒███ ▓██ ░▄█ ▒▒▓█ ▄ ▓██ ▒██░▓██ ░▄█ ▒ ▒██ ██░
▒██ ▒██ ▒▓█ ▄ ▒██▀▀█▄ ▒▓▓▄ ▄██▒▓▓█ ░██░▒██▀▀█▄ ░ ▐██▓░
▒██▒ ░██▒░▒████▒░██▓ ▒██▒▒ ▓███▀ ░▒▒█████▓ ░██▓ ▒██▒ ░ ██▒▓░
░ ▒░ ░ ░░░ ▒░ ░░ ▒▓ ░▒▓░░ ░▒ ▒ ░░▒▓▒ ▒ ▒ ░ ▒▓ ░▒▓░ ██▒▒▒
░ ░ ░ ░ ░ ░ ░▒ ░ ▒░ ░ ▒ ░░▒░ ░ ░ ░▒ ░ ▒░▓██ ░▒░
░ ░ ░ ░░ ░ ░ ░░░ ░ ░ ░░ ░ ▒ ▒ ░░
░ ░ ░ ░ ░ ░ ░ ░ ░ ░
░ ░ ░ """+Style.RESET_ALL)
@digital rose :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 1, in <module>
003 | ModuleNotFoundError: No module named 'colorama'
bot can't do modules xd
Does anyone here happen to have experience with gtk and glade? I'm attempting to convert an application i made awhile back using tkinter to gtk, but am having some trouble. My program needs to be able to dynamically add widgets, and i can't figure out how to use a container designed in glade in my code as it's own object that i can instantiate when needed.
is Error 503 always server side? Or could it be due to a bad header/endpoint client side?
So, typically when I want to change a label image in PyQt, I use a template like so:
class Update():
changed_text = ""
def __init__(self, text = None):
self.text = text
def get_text(self):
return self.text
def set_text(self, new_text):
self.text = new_text
def text_update(entered):
pull = Update()
pull.set_text(entered)
result = pull.text
template = Template("$text")
text_string = template.safe_substitute(text = result)
Update.changed_text = text_string
and
def transform (entered):
Update.text_update(entered)
template = Template("$t_score")
transformed_score = template.safe_substitute(t_score = Update.changed_text)
def paste_info(self,pre, text_variable):
template2 = Template("$text")
label_string = template2.safe_substitute(text = Update.changed_text)
text_variable(pre + label_string)
With the following code showing it in action:
Data.transform(self.name)
Data.paste_info(self, "", self.name_screen.setText)
While I can update images this way in PyQt, it doesn't seem to work when I change button backgrounds. Is there a way to do this or it isn't possible?
Well, i ended up answering my own question, so, in case anyone else comes looking for an answer to this question, the solution was to use gtk templates. I set up a separate template file for each of my classes, then used the Gtk.Template() decorator on them. This allowed me to have a class dedicated to the container that needs to be added dynamically, from there i can just instantiate new instances of it as needed.
Source:
https://gist.github.com/jjlrjjlr/b1c7a5f11e239480d612605cd90f2b75
xd
!e
print ("\
███▄ ▄███▓▓█████ ██▀███ ▄████▄ █ ██ ██▀███ ▓██ ██▓\
▓██▒▀█▀ ██▒▓█ ▀ ▓██ ▒ ██▒▒██▀ ▀█ ██ ▓██▒▓██ ▒ ██▒▒██ ██▒\
▓██ ▓██░▒███ ▓██ ░▄█ ▒▒▓█ ▄ ▓██ ▒██░▓██ ░▄█ ▒ ▒██ ██░\
▒██ ▒██ ▒▓█ ▄ ▒██▀▀█▄ ▒▓▓▄ ▄██▒▓▓█ ░██░▒██▀▀█▄ ░ ▐██▓░\
▒██▒ ░██▒░▒████▒░██▓ ▒██▒▒ ▓███▀ ░▒▒█████▓ ░██▓ ▒██▒ ░ ██▒▓░\
░ ▒░ ░ ░░░ ▒░ ░░ ▒▓ ░▒▓░░ ░▒ ▒ ░░▒▓▒ ▒ ▒ ░ ▒▓ ░▒▓░ ██▒▒▒ \
░ ░ ░ ░ ░ ░ ░▒ ░ ▒░ ░ ▒ ░░▒░ ░ ░ ░▒ ░ ▒░▓██ ░▒░ \
░ ░ ░ ░░ ░ ░ ░░░ ░ ░ ░░ ░ ▒ ▒ ░░ \
░ ░ ░ ░ ░ ░ ░ ░ ░ ░ \
░ ░ ░ ")
@digital rose :white_check_mark: Your eval job has completed with return code 0.
███▄ ▄███▓▓█████ ██▀███ ▄████▄ █ ██ ██▀███ ▓██ ██▓ ▓██▒▀█▀ ██▒▓█ ▀ ▓██ ▒ ██▒▒██▀ ▀█ ██ ▓██▒▓██ ▒ ██▒▒██ ██▒ ▓██ ▓██░▒███ ▓██ ░▄█ ▒▒▓█ ▄ ▓██ ▒██░▓██ ░▄█ ▒ ▒██ ██░ ▒██ ▒██ ▒▓█ ▄ ▒██▀▀█▄ ▒▓▓▄ ▄██▒▓▓█ ░██░▒██▀▀█▄ ░ ▐██▓░ ▒██▒ ░██▒░▒████▒░██▓ ▒██▒▒ ▓███▀ ░▒▒█████▓ ░██▓ ▒██▒ ░ ██▒▓░ ░ ▒░ ░ ░░░ ▒░ ░░ ▒▓ ░▒▓░░ ░▒ ▒ ░░▒▓▒ ▒ ▒ ░ ▒▓ ░▒▓░ ██▒▒▒ ░ ░ ░ ░ ░ ░ ░▒ ░ ▒░ ░ ▒ ░░▒░ ░ ░ ░▒ ░ ▒░▓██ ░▒░ ░ ░ ░ ░░ ░ ░ ░░░ ░ ░ ░░ ░ ▒ ▒ ░░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░
lol
lol
Hey PyCoders,
In this video I tried to create a simple application with Python Tkinter to get my internet speed.
I hope you like it.
DON'T FORGET TO SHARE, LIKE, COMMENT and SUBSCRIBE !
THANK U Coder !
Just want to remind that .get() function doesn't work
Oh... Didn't understand how to get the output
I mean something kind of a .read() function
hello! im having trouble with tkinter and ive posted my problem in the help-potato channel. please do help!
hey i got some trouble with tkinter its in #help-cake pls help
Anyone helping me? I'm in in #help-rice
Often while using dictionaries in Python, you may run into KeyErrors. This error is raised when you try to access a key that isn't present in your dictionary. Python gives you some neat ways to handle them.
The dict.get method
The dict.get method will return the value for the key if it exists, and None (or a default value that you specify) if the key doesn't exist. Hence it will never raise a KeyError.
>>> my_dict = {"foo": 1, "bar": 2}
>>> print(my_dict.get("foobar"))
None
Below, 3 is the default value to be returned, because the key doesn't exist-
>>> print(my_dict.get("foobar", 3))
3
Some other methods for handling KeyErrors gracefully are the dict.setdefault method and collections.defaultdict (check out the !defaultdict tag).
I wanted to make the plot whole screen . and also it seems like stretched. How to make it full screen and remove the stretching?
Just asking,
Are you using tkinter??
matplotlib
In matplotlib,
you can actually use
figManager=plt.get_current_fig_manager()
figManager.window.showMaximized()
thanks, I will try this. Is there any other library which I can use for 2d/3d plotting and simulation?
I think you should check this out:
https://www.researchgate.net/post/Does-anyone-know-any-good-software-or-library-for-plotting-3D-network
thanks
Welcome
If calling its get method doesn't work, then you should use a StrVar or however it's called in tkinter. You instantiate an instance of it and pass it into the variable or textvariable or something of the entry widget. This will allow you to call the variable's get and set methods to get and set the text in the entry.
Ok but for tkinter not for dicts
The tkinter entry box isn't a class so i can use the .get function
I was just trying to do smth wasn't responding to your question I am sry
Appreciate
Label.cget("text")
can someone help with this please
@scenic garden try this
import tkinter as tk
window = tk.Tk()
window.geometry("800x600+300+100")
window.title("App")
window.config(bg="#6C47F5")
window.resizable(False, False)
window.grid_rowconfigure(0, weight=1)
window.grid_columnconfigure(0, weight=1)
content = tk.Frame(window, bg="#6C47F5")
content.grid()
nick = tk.Entry(content)
password = tk.Entry(content)
nick.grid(column=0, row=0, pady=20)
password.grid(column=0, row=1, pady=20)
window.mainloop()
if you change the content frame background colour it helps to visualize whats happening when you experiment with changing options
I want to ask, which UI Lib can be used to create a simple GUI quickly and efficiently + easy to understand?
Tkinter
Really easy to use
Didn't work
The variable stores None not that tkinter widget with whom u using cget() method
What u can do is that add commamd to button
Like
Button(master, command=function_object)
Can u explain me what u are doing
Yeah then do that entry.get thing inside a function and supoose the function name is foo() so in that button writ one more argument called command with foo as value
Let me gove u a small snippet of code and try that out
Oke
Guys
How to run a loop in "background"
I need to run a tkinter interface and every second an output starts
Like
Every 2 seconds print...
Without stopping the script
There is no need to declare the entry as a global var.
It is a class
It is not Label, it is entry
You could create a conditional loop with a tk.update(root) which might be what you're looking for
root.after(2000,func_to_run) inside the func_to_run
Ok i got into another trauma...
How do i make global a variable in a function. But it mustn't be executed
To be safe side
Yeah i didnt saw that he was asking for entry, lol
what!
Nah, there is literally no reason there
Wdym
What do you want, explain it clearly
Rather than asking on how to do it, now
I know i know there ain't need fo that but my momd said to do that thats it 😅
Imma send you the code
Brb
import time
import tkinter as tk
def clicked():
global x
try:
x=print(int(number.get()))
except ValueError:
print()
#WORKING ON THE WINDOW
root=tk.Tk()
root.title('HB Converter')
root.geometry('250x130')
root.resizable(False, False)
#LABEL INPUT
label_top=tk.Label(root,text='INPUT ANYTHING TO CONVERT').pack()
#NUMBER TO CONVERT
number=tk.Entry(root,text='',bd=1)
#CONVERT BUTTON
button=tk.Button(root, text='convert',bd=0,command=clicked)
button.place(x=150,y=17)
y=button.invoke()
def try1():
try:
bin(int(number.get()))
except ValueError:
print()
def try2():
try:
hex(int(number.get()))
except ValueError:
print()
#ENTRY BOX BIN
number_bin=tk.Entry(root,text=try1(),bd=1).place(x=60,y=73)
#ENTRY BOX HEX
number_hex=tk.Entry(root,text=try2(),bd=1).place(x=60,y=100)
#BIN LABEL AND HEX LABEL
label_top3=tk.Label(root,text='bin').place(x=10,y=75)
label_top4=tk.Label(root,text='hex').place(x=10,y=101)
number.place(x=7,y=20)
root.mainloop()
i'm having issues in the #ENTRY BOX BIN paragraph
!code
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.
Any advice?
First format the code accordingly
Al i need is to make of it a variable
import tkinter as tk
def clicked():
global x
try:
x=print(int(number.get()))
except ValueError:
print()
#WORKING ON THE WINDOW
root=tk.Tk()
root.title('HB Converter')
root.geometry('250x130')
root.resizable(False, False)
#LABEL INPUT
label_top=tk.Label(root,text='INPUT ANYTHING TO CONVERT').pack()
#NUMBER TO CONVERT
number=tk.Entry(root,text='',bd=1)
#CONVERT BUTTON
button=tk.Button(root, text='convert',bd=0,command=clicked)
button.place(x=150,y=17)
y=button.invoke()
def try1():
try:
bin(int(number.get()))
except ValueError:
print()
def try2():
try:
hex(int(number.get()))
except ValueError:
print()
#ENTRY BOX BIN
number_bin=tk.Entry(root,text=try1(),bd=1).place(x=60,y=73)
#ENTRY BOX HEX
number_hex=tk.Entry(root,text=try2(),bd=1).place(x=60,y=100)
#BIN LABEL AND HEX LABEL
label_top3=tk.Label(root,text='bin').place(x=10,y=75)
label_top4=tk.Label(root,text='hex').place(x=10,y=101)
number.place(x=7,y=20)
root.mainloop()```
No bro
Oh sry
import time
import tkinter as tk
def clicked():
global x
try:
x=print(int(number.get()))
except ValueError:
print()
#WORKING ON THE WINDOW
root=tk.Tk()
root.title('HB Converter')
root.geometry('250x130')
root.resizable(False, False)
#LABEL INPUT
label_top=tk.Label(root,text='INPUT ANYTHING TO CONVERT').pack()
#NUMBER TO CONVERT
number=tk.Entry(root,text='',bd=1)
#CONVERT BUTTON
button=tk.Button(root, text='convert',bd=0,command=clicked)
button.place(x=150,y=17)
y=button.invoke()
def try1():
try:
bin(int(number.get()))
except ValueError:
print()
def try2():
try:
hex(int(number.get()))
except ValueError:
print()
#ENTRY BOX BIN
number_bin=tk.Entry(root,text=try1(),bd=1).place(x=60,y=73)
#ENTRY BOX HEX
number_hex=tk.Entry(root,text=try2(),bd=1).place(x=60,y=100)
#BIN LABEL AND HEX LABEL
label_top3=tk.Label(root,text='bin').place(x=10,y=75)
label_top4=tk.Label(root,text='hex').place(x=10,y=101)
number.place(x=7,y=20)
root.mainloop()```
Is there a software that allows me to design a GUI by just dragging and dropping objects onto a canvas/frame. For example, a section for the design and a section for the code.
No
In order to design GUI apps you need to code positions. Like (x=-17,y=22)
https://visualtk.com/
i have found this website
With Visual TK, you can design Tkinter Form(Window) by dragging and dropping Widgets Button, Lables, CheckBox, RadioBox, Entry, ListBox, Message, Container and Frame.
That's right. But to customize and give widgets their own feature you have to code
import time
import tkinter as tk
def clicked():
global x
try:
x=print(int(number.get()))
except ValueError:
print()
#WORKING ON THE WINDOW
root=tk.Tk()
root.title('HB Converter')
root.geometry('250x130')
root.resizable(False, False)
#LABEL INPUT
label_top=tk.Label(root,text='INPUT ANYTHING TO CONVERT').pack()
#NUMBER TO CONVERT
number=tk.Entry(root,text='',bd=1)
#CONVERT BUTTON
button=tk.Button(root, text='convert',bd=0,command=clicked)
button.place(x=150,y=17)
y=button.invoke()
def try1():
try:
bin(int(number.get()))
except ValueError:
print()
def try2():
try:
hex(int(number.get()))
except ValueError:
print()
#ENTRY BOX BIN
number_bin=tk.Entry(root,text=try1(),bd=1).place(x=60,y=73)
#ENTRY BOX HEX
number_hex=tk.Entry(root,text=try2(),bd=1).place(x=60,y=100)
#BIN LABEL AND HEX LABEL
label_top3=tk.Label(root,text='bin').place(x=10,y=75)
label_top4=tk.Label(root,text='hex').place(x=10,y=101)
number.place(x=7,y=20)
root.mainloop()
I got issues with this, i need to make x global and transform it into an integer
Some helps would be really appreciated because in a week i didn't find an answer
Hi, I'm trying to recreate my Figma design, is it possible to make something like the selected layer in Figma? I use Tkinter btw
Yes, it is possible
Thanks , can you show me how? I just started to learn about Python for a while
There is a drop down selecting widget like the one shown in the screenshot, and you can always create new secondary windows using a Toplevel widget
Let me find you the menu widget
ah thank you!
It's called OptionMenu, you import it as you import any other tkinter widget
This one covers more: https://pythonguides.com/python-tkinter-optionmenu/
Thanks!
You could try tkinter.ttk.ComboBox, too. tkinter.ttk provides new widgets, some of which are remakes of existing widgets. They are supposed to look more.. modern, and you can style some of them more than tkinter widgets.
To style these widgets you need to use a Style object
in my opinion having used both, TTK combo box is much much better than option menu
So guys, I need some help with GUI layout
Does this look like a bad GUI layout?
It's a toplevel window used to edit a specific feature
Somebody help me?
Incorrect. There are quite a few such libs.
I think it will maybe look better if you had it like a tall window instead of a wide window, because you have, like, a list
Okay explain what you need
You dont mean button, you mean the output of the entry
Oh yes sorry
No
I want the output
But i want it after clicking it not when the program is executed
I might be able to give you the answer here, but you will encounter more problems if you dont go through a basic tutorial and understand how tkinter works
Basically you want to show the output of the functions in the entry widgets after the button is clicked
This is how I would write a code on tkinter
import tkinter as tk
#WORKING ON THE WINDOW
root = tk.Tk()
root.title('HB Converter')
root.geometry('250x130')
root.resizable(False, False)
def clicked():
# Clear the entries first
number_bin.delete(0,'end')
number_hex.delete(0,'end')
try:
inp = int(number.get()) # Get the input and covert to int
# Conver the input
binary = bin(inp)
hexa = hex(inp)
# Insert the converted values onto the respective widgets
number_bin.insert('end',binary)
number_hex.insert('end',hexa)
except ValueError:
print('Input proper numbers')
return
#LABEL INPUT
tk.Label(root,text='INPUT ANYTHING TO CONVERT').pack()
#NUMBER TO CONVERT
number = tk.Entry(root,bd=1)
number.place(x=7,y=20)
#CONVERT BUTTON
button = tk.Button(root, text='convert',bd=0,command=clicked)
button.place(x=150,y=17)
#ENTRY BOX BIN
number_bin = tk.Entry(root,bd=1)
number_bin.place(x=60,y=73)
#ENTRY BOX HEX
number_hex = tk.Entry(root,bd=1)
number_hex.place(x=60,y=100)
#BIN LABEL AND HEX LABEL
tk.Label(root,text='bin').place(x=10,y=75)
tk.Label(root,text='hex').place(x=10,y=101)
root.mainloop()
Look how the code is organized to be readable. Also read https://stackoverflow.com/q/1101750/13382000 to understand the most basic mistakes all the beginner makes with tkinter
Upto you 🙂
I would put it in a class
Not for a beginner doe
is this with tkinter?
Yes
looks so clean as if its a C# form app
how is that
like the buttons style
and the sort of text
I used ttk buttons
how
its so different
to me
mine looks so garbage and old
idk how people could make some nice form apps look ,like this with tkinter
1 sec
root = Tk()
root.geometry("700x700")
button1 = tk.Button(root, text = "TK Button")
button1.pack(pady = 10, padx = 10)
button2 = ttk.Button(root, text = "TTK Button")
button2.pack(pady = 10, padx = 10)
root.mainloop()
thats just some sample code
My friend that has already finished school told me that for GUI, pygame is the best library
Dear ImGui is a GUI library for C++ that has Python bindings. Let's see how to use these Python bindings, and then go through the process of adding a more Pythonic interface to the library by added context manager "with" statement support.
Note: the PR in this video has been ACCEPTED! Coming to a release near you soon!
― mCoding with James Mur...
its not relevant but idk
trnn
@buoyant fulcrum sorry but can you show me the part of imports and ?
cuz i had a problem with some things that are undefined
oh ok
nvm
i got it
bruh the buttons style
looks ass
how do you have it like that
oh i got nvm again
lol
Did it work?
dont ask to ask
u can ask and v vl help u out
fastest and easiest way to make Linux GUIs?
not using tkinter it's a pain in the ass
use Pygame for the hi-res screen and Tkinter for the click - click interface
Pyqt5 is an alternative to Tkinter. It’s difficult to learnt though (so I’ve heard)
sus
Hey, if you want to create good looking GUI, then you can check out this library I made. Its an extension to Tkinter with new widgets and its easy to use: https://github.com/TomSchimansky/CustomTkinter
WOWEEEEE!!!
why does my program crash
it just stops working and says (not responding) everytime
Cool!
What program
Did u insert root.mainloop() at the end of the script?
Root is meant to be the window variable, for example root = Tk()
Great job man!
How can I update my Tkinter Gui and then return to the main code? So I have a program like this:
while True:
x = int(input("x:"))
y = x*x
update_gui(y) # how do I implement a function like this?
tk.Tk.update(root)
(assuming you imported tkinter as tk and named your base window as root)
But I want to update the window with some information that I computed ( the variable y in my case) how do I do that?
For instance, if you were adding the info in the form of a label, you create the label and position it. tkinter would automatically update the gui. I add the tk.Tk.update(root) as good measure.
say you want to update a name.
import tkinter as tk
#YOUR CODE HERE
def update_name():
Label(root, text=text).pack()
tk.Tk.update(root)
#Shows the lebel on screen.
This doesn't really work for me. I have a window with just text. I want to be able to scroll in it. Only once in a while the main loop updates the window (in my case it updates some background colours)
With the current code I can't scroll. Only once the complete script is done, I can scroll the Tkinter window.
Any way to fix that (I would guess I need threading)
@full marlin this is sick
i just tried the designer of it and its so amazing
and easy
wow
there is a designer app
for it
Oh cool
it makes you feel like if youre making a C# form app but its with python source
can i ask about react + python here or no
Can you share it for me? Pyqt5 is too hard for me 🥲
nvm found it
yeah you're right! Let me try to learn PyQt5 instead of Tkinter XD
Does anyone know how I can maintain a stretch (QSpacerItem) at the end of my vbox items?
I have a vbox I dynamically add buttons to but I want it to always end with a stretch
right now I'm thinking of removing the stretch, adding the new button, then adding the stretch back in, but that seems excessive. Can I simply reorder the vbox?
ahh found the solution, there's an insertWidget method
That doesn't do what u expect it to do
It is never a good idea to call update unless really necessary
after() exists
How does it work/ how would you implement it?
I want something like this: ```py
this could also be handled in a class
root = tk.Tk()
txt = tk.Text(root)
put a few lines of text on txt
txt.pack()
while True:
line_num = int(input("line num"))
highlite_line(line_num)
I know how to highlight a line with `txt.tag_options` and so on, but I don't know how to use `after`. Maybe you need an `on_idle` function 🤷
How would you implement highlight_line
yea its soo clean
anyone here a multiprocessing expert?
How can I make a window unselectable?
in tkinter
I am trying to make the root not be able to be clicked
so whenever you click it will just pass through it
I have it set to be always on top
since it is kind of a overlay
How would I also hide the root
root.withdraw()
Okay can you awnser my question above?
No, IDK
i need help on tkinter problems
anyone could help me
it is my first time using classes with tkinter
i got some errors here and idk how to repair it for my class
hi guyssssssssssss
is TKinter used for Just GUIs?
Yes
yes
PyQt
yeh I legit started using it after that message
pyside6
fast af
and painless too!
Glad to hear
Hmmm
How to make a button disable if combobox is empty in tkinter? Thanks
https://github.com/HuyHung1408/Run my code here
may i ask what is keyword arguments in python
can u use if statements?
yeah but idk how to make a condition if the combobox is empty
if the entrybox is empty means if u use the get method, u will get an empty string
so maybe u can say like if .get() the entrybox == "" then ...
ah got it, thanks
Tkinter canvas while drawing sucks at this thing, the line isnt continuous when moise moves so fast
Arguments that have a keyword, like def func(foo, bar='hey'), here bar is keyword argument or kwarg and foo is positional argument or arg
ok noted
Right. You can save two points and draw a line between them
Aah i am talking about free hand drawing where u just keep on assing point when a cursor is dragged over it
But the points arent continuous
Yeah. I think it might be a limitation of the mouse, its update intervals might not be small enough
I know that Windows doesn't store mouse positions, but rather offsets (notice how each time you start a Windows computer, your mouse is set at the center of the screen)
So in each update, it tells the operating system how right or down it moved
Aah i shouldut intereogate it
It seems like it has missed some points, but then how paint gets this all right
I think i need to manually comnect the dot with revording each last location 😅
Yeah boiii big brain plau 😀
🤣 new problem arrived, that when width is at 10 it still gives some edge problem
I think i need to draw tiny circles
If you know how to connect two points to form a line then you can take point values at small intervals and connect the points continually.
There is still some issues that when the thickness (width) is larger than 1 u start to notice the jaggedes edges of lines as they are drawn from the normal to the tangent of line
So edges arnt smooth
Hey! I'm programming a typing game with tkinter and I was wondering if anyone had an idea how to make a stylier user interface 🙂
Looks incredible! Could a text scroll box and plots be integrated with the same look?
pyqt
whats the diff between that and pyside other than licence?
you can't use pyqt commercially (unless u buy the license)
but you can with pyside
I can try to implement a TextBox yes, and you can integrate plots with matplotlib and style them yourself, but I can try to create a template maybe
How would I implement a subgraph using NodeGraphQt? The only "example" is very complex and not easy to understand (https://github.com/jchanvfx/NodeGraphQt/, see auto_nodes example)
https://paste.pythondiscord.com/imiduforon someone help trying to split image into 100 vertical sections and save each section as separate image but image saved at end is same image as inputted
for loop through images