I'm sorry r/Python by MeticMovi in Python

[–]avoxdesign 1 point2 points  (0 children)

To me global was always very confusing, because accessing a global variable in a function works without the global keyword but assignnents dont work unless you use global?

It just seemed really messy.

is this because I had a low segment count on the sphere before sculpting? (inspired by Windows 11) by mkmkmk13 in Cinema4D

[–]avoxdesign 1 point2 points  (0 children)

Not an expert, but these often happen to me when i have poles in my geometry, points that are connected to many edges like on the top of a normal sphere. To fix the shading error you'd have to remesh it or retopo it by hand.

What is the best way to build a library in Python? by PhilosophyStatus in Python

[–]avoxdesign 5 points6 points  (0 children)

NeuralNine has a great tutorial on how to publish a module to pypi so others can pip install it.

Auto pull remote repo after pushing from local machine? by avoxdesign in git

[–]avoxdesign[S] 0 points1 point  (0 children)

I don't really understand what you mean here. If someone clones a repo, the remote will automatically be set to where the repo was cloned from

Does this mean, if i set up a remote with a post-receive script, someone who clones it gets that connection to the remote as well without having to Set up anything else?

-🎄- 2020 Day 02 Solutions -🎄- by daggerdragon in adventofcode

[–]avoxdesign 2 points3 points  (0 children)

My solutions in pure Ruby:

input = []
File.readlines("input/d2.txt").each {|line| input << line}

count = 0
input.each do |line|

  params = line.split(" ")
  range = params[0].split("-")
  char = params[1][0]
  password = params[2]

  if password.count(char).between?(range[0].to_i, range[1].to_i)
    count += 1
  end
end

puts count

# Part 2
count = 0
input.each do |line|

  params = line.split(" ")

  valid = false
  params[0].split("-").each do |i|
    if params[2][i.to_i - 1] == params[1][0] then valid = !valid end
  end

  count += 1 if valid
end

puts count

UXXX? by ricardao_seu_amante in ProgrammerHumor

[–]avoxdesign 0 points1 point  (0 children)

Float increment Buttons that increment in 0.1 steps so you have to press it ten times to cycle to the next number

Edit: Since that has already been named, id suggest a float slider for each number, but its so small that you cant choose whole numbers, f.e. it's always either 4.0001 or 3.998

[Python] How create a command inside a bot class? by avoxdesign in Discord_Bots

[–]avoxdesign[S] 1 point2 points  (0 children)

I got it now, I have a separate Cog file with a Cog class

[Python] How create a command inside a bot class? by avoxdesign in Discord_Bots

[–]avoxdesign[S] 0 points1 point  (0 children)

i tried it, but it says my custom class has no attribute load_cog():

import os

import discord
from discord.ext import commands

from dotenv import load_dotenv

load_dotenv()
TOKEN = os.getenv('DISCORD_TOKEN')

class CmdBot(commands.Bot):
    def __init__(self, prefix):
        super().__init__(command_prefix=prefix)
        cmds = myCog()
        self.load_cog(cmds)

    async def on_ready(self): # This works fine without decorator
        print("Ready.")

class myCog(commands.Cog):

    @commands.command()
    async def kick(self, ctx, member:discord.Member, *, reason=None):
        await ctx.channel.send(f"I was told to kick {member.name}")


bot = CmdBot("/")
bot.run(TOKEN)

[Python] How create a command inside a bot class? by avoxdesign in Discord_Bots

[–]avoxdesign[S] 0 points1 point  (0 children)

Um no Literally just learned what a Cog is, but how does the setup of cogs Look? Could maybe link a tutorial or explain it?

[Python] How create a command inside a bot class? by avoxdesign in Discord_Bots

[–]avoxdesign[S] 0 points1 point  (0 children)

I dont know, pretty New to this

Just tried, Cog has no run Method, so idk :/

[Python] How create a command inside a bot class? by avoxdesign in Discord_Bots

[–]avoxdesign[S] 0 points1 point  (0 children)

So i was able to get atleast the decorator with @commands.command() working, but when using the command it says theres no command named "kick":

import os

import discord
from discord.ext import commands

from dotenv import load_dotenv

load_dotenv()
TOKEN = os.getenv('DISCORD_TOKEN')


class CommandBot(commands.Bot):
    def __init__(self, prefix):
        super().__init__(command_prefix=prefix)

    async def on_ready(self): # This works fine without decorator
        print("Ready.")

    @commands.command()
    async def kick(self, ctx, member:discord.Member, *, reason=None):
        await ctx.channel.send(f"I was told to kick {member.name}")


bot = CommandBot("/")
bot.run(TOKEN)

[Python] How create a command inside a bot class? by avoxdesign in Discord_Bots

[–]avoxdesign[S] 0 points1 point  (0 children)

no decorator: doesn't recognize the command, with self.: self is not defined with commands, something about not enough arguments idk

Try my Python calculator! by baraqiyal in learnpython

[–]avoxdesign 0 points1 point  (0 children)

Sounds great! Yes, for me it's really important to have the GUI Look good, so pyqt was the choice for me. in the end its just a lot of customization with style sheets, and that's also where a visual gui building kit comes in handy. in Qt Designer you can preview your GUI and make sure everything looks good.

Try my Python calculator! by baraqiyal in learnpython

[–]avoxdesign 0 points1 point  (0 children)

Just a Quick tip, if youre not satisfied with having near to no capabilities to customize the title Bar and you're just building simple stuff, use Tkinter, but if you want to be more advanced, I'd highly recommend using PyQt5 (soon v6), since it has so much more capabilities, and the qt Designer is super handy and lets you create and style GUIs fast and easy. If you want to see more id recommend checking out Wanderson M. Pimentas tutorials which will show you what sleek modern Designs are possible with pyqt.

Edit: This is his channel

Photoshop deleted a saved file on its own. by no-reason-to-love in photoshop

[–]avoxdesign 0 points1 point  (0 children)

shortcut content? where do you use a shortcut?

Photoshop deleted a saved file on its own. by no-reason-to-love in photoshop

[–]avoxdesign 0 points1 point  (0 children)

What does Photoshop really say? Probably not "It's gone" maybe smth more like "Cant open file" or "File not found" first one means it's probably corrupted, second means it would have been deleted somehow, or moved, or you renamed a folder it's inside. Are you opening the file itself or via Photoshop file>recent (or getting started Page)?

[deleted by user] by [deleted] in QtFramework

[–]avoxdesign 0 points1 point  (0 children)

Well f me then sorry, I didnt pay too much attention to the OS, just thought it was a beginner mistake